Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How do you say in VBE language to go to the last filled cell?

I don't think CountA works if there are blank cells in your column. I
either use the UsedRange property if I'm not concerned about the last cell
in a specific column/row, but, rather all columns/rows. For a specifice
column/row, I always rely on a loop that walks through the cells until it
finds the end. I'm sure, though, that there must be a better way and would
love to hear about it if anyone knows of one. Here's a sample of my
approach:

Function GetLastCellInColumn (ws as Excel.Worsheet, iCol as Integer) As
Integer
'
' Find last filled cell in column iCol on Worksheet ws
'
Dim LastCellInColumn as Integer

LastCellInColumn = ws.UsedRange.Rows.Count

Do while trim(ws.Cells(LastCellInColumn, iCol)) = "" and
LastCellInColumn 0
LastCellInColumn = LastCellInColumn - 1
Loop

GetLastCellInColumn = LastCellInColumn
End Function

"Blewyn" wrote in message
...

Number_of_rows = WorksheetFunction.CountA(Range("A1:A" & Rows.Count))

Cells(Number_of_rows,1).Activate

Cheers,

Blewyn

PS This advice given to me by Ron de Bruin in response to a smiliar
question a couple of days ago.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
How to change German language data into Eglish Language in a colum Execel work sheet language problems Excel Discussion (Misc queries) 1 October 29th 07 09:59 PM
language support in excel sheet using a third party language tool seema Excel Worksheet Functions 0 March 13th 06 06:06 AM
How can I programatically change the language in the language bar? Roy Barr Excel Discussion (Misc queries) 0 March 14th 05 09:47 PM
How to change the excel format from language to language? zee Excel Discussion (Misc queries) 2 January 30th 05 06:51 PM
How do you say in VBE language to go to the last filled cell? Nick Hodge Excel Programming 3 October 27th 04 07:15 PM


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

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

About Us

"It's about Microsoft Excel"