Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try using ActiveSheet.UsedRange. It should reflect the rows in your current
data: Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 MsgBox ("last row " & nLastRow) nLastColumn = r.Columns.Count + r.Column - 1 MsgBox ("last column " & nLastColumn) nFirstRow = r.Row MsgBox ("first row " & nFirstRow) nFirstColumn = r.Column MsgBox ("first column " & nFirstColumn) numrow = r.Rows.Count MsgBox ("number of rows " & numrow) numcol = r.Columns.Count MsgBox ("number of columns " & numcol) etc. -- Gary''s Student "smurrock" wrote: I am trying to set up a macro to run for a data file that will not have a consistent number of lines each month. This seems like it should be simple, however I am struggling. I tried using relative references but either I didn't set it up right or it won't work. I also tried using offset which also failed. This seems pretty basic?? Thanks!! Sidonia |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
30-yr Amortization allowing 26 payments per year/780 lines vs 360 | Excel Worksheet Functions | |||
How can I lock worksheets while still allowing macros to operate? | Excel Discussion (Misc queries) | |||
How can I lock worksheets while still allowing macros to operate? | Excel Discussion (Misc queries) | |||
Allowing for variable cell reference in macro | Excel Worksheet Functions | |||
Allowing Macros in Excel | Setting up and Configuration of Excel |