In Excel, let me have data in B2 from B7 and C2 to C7. In VBA, I can write a macro to select it:
Sub Macro1()
Range("B2:C7").Select
End Sub
How can I rewrite the code so that it automatically selects cells that are not empty? If I delete the data in cells B7 and C7, then I want the macro to select only Range (B2: C6) and if I add the data to cells B8 and C8, then I want the macro to select Range (B2: C8).
My data will always run B2, C2, and I will not have free space between the data.
source
share