I'm trying to make a macro to help me in format some files, but each file has different number of rows (but always same number of columns). I defined the last range as 99999
because i don't know how to make the macro recognize the last row with some data and stop there.
Someone can help?
Thank you
Rows("1:26").Select
Selection.Cut
Sheets.Add After:=ActiveSheet
ActiveSheet.Paste
Range("C16").Select
Sheets("teste").Select
Selection.Delete Shift:=xlUp
Range("I3:N99999").Select
Selection.Cut
Range("I1").Select
ActiveSheet.Paste
Range("P3:P99999").Select
Also tried and had success:
Dim Nb_Rows As Integer
Nb_Rows = WorksheetFunction.CountA(Range("H:H"))
For i = 1 To Nb_Rows
Range("I" & i).Value = Range("H" & i).Value + Range("F" & i).Value
Next i