I have a worksheet as below. I wrote the VBA code, look for value changes in column C then select and copy the selection to another worksheet and save a prn file. ie. I'll three blocks to copy A1:C2; A3:C3; and A5:C6
A B C
1 843779.9 262620.2 S159110
2 843710.7 268730.7 S159110
3 833313.5 262420.2 S159111
4 830603.9 268563.5 S159112
5 825349.7 268494.2 S159112
Could anyone help me to identify the cells in column A C(cellA) in the below code:
Sub test()
Dim d As Range
Dim cellA, cellB As String
For Each d In Intersect(ActiveSheet.UsedRange, Range("C:C"))
If d.Offset(0, 0) <> d.Offset(1, 0) Then
cellB = d.Offset(0, 0).Address(RowAbsolute:=False, ColumnAbsolute:=False)
cellA = ????
Range(cellB, cellA).Select
Selection.Copy
'Paste to another worksheet and save as prn: I got this part.
End If
Next d
End Sub
Many thanks,
TU
A B C
1 843779.9 262620.2 S159110
2 843710.7 268730.7 S159110
3 833313.5 262420.2 S159111
4 830603.9 268563.5 S159112
5 825349.7 268494.2 S159112
Could anyone help me to identify the cells in column A C(cellA) in the below code:
Sub test()
Dim d As Range
Dim cellA, cellB As String
For Each d In Intersect(ActiveSheet.UsedRange, Range("C:C"))
If d.Offset(0, 0) <> d.Offset(1, 0) Then
cellB = d.Offset(0, 0).Address(RowAbsolute:=False, ColumnAbsolute:=False)
cellA = ????
Range(cellB, cellA).Select
Selection.Copy
'Paste to another worksheet and save as prn: I got this part.
End If
Next d
End Sub
Many thanks,
TU