Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 166
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Programming 1 August 21st 08 10:13 PM
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON CAPTGNVR Excel Programming 2 July 8th 07 04:18 PM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM


All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"