jarnold231
New Member
- Joined
- Jul 20, 2012
- Messages
- 2
Hello all,
I'm having trouble getting the subtraction element of this code to work on the final row of data each time it is run instead of only on the specific cells which are referenced in the code. I've tried using
Dim lrb As Long
With Sheets ("________")
lrb = .Range ("F" & Rows.Count) .End(3).Row
But this doesnt seem to help.
Any ideas greatly appreciated.
<code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: inherit; font-weight: inherit; font-family: monospace; line-height: 12px; ">Sub SubtractionElement()Dim lrb As LongWith Sheets("_________") lrb = .Range("F" & Rows.Count).End(3).RowSheets("____________").Range("F2").Copy .Range("B" & lrb + 1)Application.Run "Copy______Data"Dim x As Double x = CDbl(Worksheets("________").Cells(2, 3).Value) - CDbl(Worksheets("_________").Cells(2, 2).Value) Worksheets("_________").Cells(2, 3).Value = xEnd WithEnd Sub</code></pre>
I'm having trouble getting the subtraction element of this code to work on the final row of data each time it is run instead of only on the specific cells which are referenced in the code. I've tried using
Dim lrb As Long
With Sheets ("________")
lrb = .Range ("F" & Rows.Count) .End(3).Row
But this doesnt seem to help.
Any ideas greatly appreciated.
<code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-style: inherit; font-weight: inherit; font-family: monospace; line-height: 12px; ">Sub SubtractionElement()Dim lrb As LongWith Sheets("_________") lrb = .Range("F" & Rows.Count).End(3).RowSheets("____________").Range("F2").Copy .Range("B" & lrb + 1)Application.Run "Copy______Data"Dim x As Double x = CDbl(Worksheets("________").Cells(2, 3).Value) - CDbl(Worksheets("_________").Cells(2, 2).Value) Worksheets("_________").Cells(2, 3).Value = xEnd WithEnd Sub</code></pre>