Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options | Excel Discussion (Misc queries) | |||
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 | Excel Worksheet Functions | |||
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 | Excel Programming | |||
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON | Excel Programming | |||
How to create/run "cell A equals Cell B put Cell C info in Cell D | Excel Discussion (Misc queries) |