![]() |
Last Cell In Row
Found this vis Goggle
Sub LastCellInRow() Range("IV1").End(xlToLeft).Select End Sub It says it gives you the last Cell in a row. But I can't see where you tell it the row or how you see the result. I know my highest col is "CP" or 94 and was going to use this - for x = 94 to 1 step -1 if Cells(10,x) "" then Answer = x:Exit For next x Once the fisrt method is working, which is best ? Thanks - Kirk |
Last Cell In Row
This is the fastest way to find the last column with a value in it for Row 1.
Just change the row number to find the last column with a value in it. ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column -- Cheers, Ryan "kirkm" wrote: Found this vis Goggle Sub LastCellInRow() Range("IV1").End(xlToLeft).Select End Sub It says it gives you the last Cell in a row. But I can't see where you tell it the row or how you see the result. I know my highest col is "CP" or 94 and was going to use this - for x = 94 to 1 step -1 if Cells(10,x) "" then Answer = x:Exit For next x Once the fisrt method is working, which is best ? Thanks - Kirk |
Last Cell In Row
Hi,
what's the question? All this code does is find the last cell on row 1 that contains data provided that IV1 does not contain data. -- Thanks, Shane Devenshire "kirkm" wrote: Found this vis Goggle Sub LastCellInRow() Range("IV1").End(xlToLeft).Select End Sub It says it gives you the last Cell in a row. But I can't see where you tell it the row or how you see the result. I know my highest col is "CP" or 94 and was going to use this - for x = 94 to 1 step -1 if Cells(10,x) "" then Answer = x:Exit For next x Once the fisrt method is working, which is best ? Thanks - Kirk |
Last Cell In Row
On Mon, 10 Nov 2008 21:26:00 -0800, RyanH
wrote: This is the fastest way to find the last column with a value in it for Row 1. Just change the row number to find the last column with a value in it. ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column Thank you ! Cheers - Kirk |
Last Cell In Row
On Mon, 10 Nov 2008 21:55:00 -0800, ShaneDevenshire
wrote: Hi, what's the question? All this code does is find the last cell on row 1 that contains data provided that IV1 does not contain data. Gidday, Really? Glad it works for some then ! How did you get a return value and what is IV1 ? I was lost after realising that wasn't a line number - to reference the column from ! Cheers - Kirk |
Last Cell In Row
IV1, IV is the Column Label and 1 is the Row Label.
If my posts helped. Please click "YES" below. -- Cheers, Ryan "kirkm" wrote: On Mon, 10 Nov 2008 21:55:00 -0800, ShaneDevenshire wrote: Hi, what's the question? All this code does is find the last cell on row 1 that contains data provided that IV1 does not contain data. Gidday, Really? Glad it works for some then ! How did you get a return value and what is IV1 ? I was lost after realising that wasn't a line number - to reference the column from ! Cheers - Kirk |
Last Cell In Row
On Tue, 11 Nov 2008 05:47:01 -0800, RyanH
wrote: IV1, IV is the Column Label and 1 is the Row Label. I should give up ! The requirement was to find the column - that example seems to want it first, but if you knew what it was you wouldnt need to know again !!!! Cheers - Kirk |
All times are GMT +1. The time now is 07:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com