Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I have a few worksheets with different number of columns used for data. Each month these sheets gets updated with new rows. I need to add totals at the bottom of the data for each sheet and colour that row. I need to be able to select the bottom row from column A to the correct column number in each sheet. My problem is finding the last cell address on the same row under the correct column. I want ot write: Range(("A6").end(xldown),???).select I need to just select the last row. Row 5 contains the headers and I can use Range("A5").end(xlright) to find the last used column. But do not know how to combine these to select the last row from column A to column ???. Please note that not all columns contain data but they have headers in row 5. Your help is appreciated. UJ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
dim lastCol as long dim LastRow as long with activesheet lastcol = .cells(5,.columns.count).end(xltoleft).column lastrow = .cells(.rows.count,"A").end(xlup).row .range(.cells(lastrow,1),.cells(lastrow,lastcol)). select end with I started at the right most cell in row 5 (IV5) and worked back to the left. I started at the bottom of column A (A65536) and worked up. Uddinj1 wrote: Hi All, I have a few worksheets with different number of columns used for data. Each month these sheets gets updated with new rows. I need to add totals at the bottom of the data for each sheet and colour that row. I need to be able to select the bottom row from column A to the correct column number in each sheet. My problem is finding the last cell address on the same row under the correct column. I want ot write: Range(("A6").end(xldown),???).select I need to just select the last row. Row 5 contains the headers and I can use Range("A5").end(xlright) to find the last used column. But do not know how to combine these to select the last row from column A to column ???. Please note that not all columns contain data but they have headers in row 5. Your help is appreciated. UJ -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
divide column(x) by column(y) to give column(x/y) in excel? | New Users to Excel | |||
Calculating column A * column B = Results in another column | Excel Worksheet Functions | |||
Referencing date column A & time column B to get info from column | Excel Discussion (Misc queries) | |||
Return text in Column A if Column B and Column K match | Excel Worksheet Functions | |||
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look | Excel Discussion (Misc queries) |