#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Last Row

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select


This formula finds all the blank spaces then moves up one and selects the
cells. The problem is that it selects all the way to the bottom of Excel,
line 65000 SO, how do I get it to just select to the last row in the
dataset??? THANKS!!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Last Row

Here's the code that I got off of someone else for find the last row in
a given column.

LastRow = Columns("A").Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

Die_Another_Day
bodhisatvaofboogie wrote:
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select


This formula finds all the blank spaces then moves up one and selects the
cells. The problem is that it selects all the way to the bottom of Excel,
line 65000 SO, how do I get it to just select to the last row in the
dataset??? THANKS!!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Last Row

I'm curious how to plug a last row formula into my code.

so

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
+
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
= WHAT???

I've used that lastrow formula for a lot of other things and it has worked
pretty well....but I don't know how to combine the two. Any suggestions?
THANKS!!!

"bodhisatvaofboogie" wrote:

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select


This formula finds all the blank spaces then moves up one and selects the
cells. The problem is that it selects all the way to the bottom of Excel,
line 65000 SO, how do I get it to just select to the last row in the
dataset??? THANKS!!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Last Row

I don't quite understand what you are doing. can you post more of your
code?

Die_Another_Day

bodhisatvaofboogie wrote:
I'm curious how to plug a last row formula into my code.

so

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
+
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
= WHAT???

I've used that lastrow formula for a lot of other things and it has worked
pretty well....but I don't know how to combine the two. Any suggestions?
THANKS!!!

"bodhisatvaofboogie" wrote:

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select


This formula finds all the blank spaces then moves up one and selects the
cells. The problem is that it selects all the way to the bottom of Excel,
line 65000 SO, how do I get it to just select to the last row in the
dataset??? THANKS!!!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Last Row

On Error Resume Next
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
On Error GoTo 0

This is my current code....It selects all blanks in column A, offsets them
up one row (selecting the cell above it) then adds the color highlighting of
Yellow (.colorindex = 6) to each cell selected.


My problem with it is that it will select ALL blank cells in column A right
on down to row 65000....well my data set is not that long, and I end up with
a bunch of highlghted cells from the bottom of the data set to row 65000.
Normally that wouldn't be so bad, but that screws up the rest of the macro.
Essentially I need to have it only select the blanks within the range of my
data set..IE: go to the last row and stop highlighting. Make sense???

"Die_Another_Day" wrote:

I don't quite understand what you are doing. can you post more of your
code?

Die_Another_Day

bodhisatvaofboogie wrote:
I'm curious how to plug a last row formula into my code.

so

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
+
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
= WHAT???

I've used that lastrow formula for a lot of other things and it has worked
pretty well....but I don't know how to combine the two. Any suggestions?
THANKS!!!

"bodhisatvaofboogie" wrote:

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select


This formula finds all the blank spaces then moves up one and selects the
cells. The problem is that it selects all the way to the bottom of Excel,
line 65000 SO, how do I get it to just select to the last row in the
dataset??? THANKS!!!





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Last Row

Try Range("A1",Range("A" & LastRow)).SpecialCells......Yada yada yada
instead of all of column a
HTH

Die_Another_Day
bodhisatvaofboogie wrote:
On Error Resume Next
Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
On Error GoTo 0

This is my current code....It selects all blanks in column A, offsets them
up one row (selecting the cell above it) then adds the color highlighting of
Yellow (.colorindex = 6) to each cell selected.


My problem with it is that it will select ALL blank cells in column A right
on down to row 65000....well my data set is not that long, and I end up with
a bunch of highlghted cells from the bottom of the data set to row 65000.
Normally that wouldn't be so bad, but that screws up the rest of the macro.
Essentially I need to have it only select the blanks within the range of my
data set..IE: go to the last row and stop highlighting. Make sense???

"Die_Another_Day" wrote:

I don't quite understand what you are doing. can you post more of your
code?

Die_Another_Day

bodhisatvaofboogie wrote:
I'm curious how to plug a last row formula into my code.

so

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select
+
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
= WHAT???

I've used that lastrow formula for a lot of other things and it has worked
pretty well....but I don't know how to combine the two. Any suggestions?
THANKS!!!

"bodhisatvaofboogie" wrote:

Columns("A").SpecialCells(xlBlanks).Offset(-1).Select


This formula finds all the blank spaces then moves up one and selects the
cells. The problem is that it selects all the way to the bottom of Excel,
line 65000 SO, how do I get it to just select to the last row in the
dataset??? THANKS!!!




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Last Row

Range(("A1"), Range("A65500").End(xlUp)).Select

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Last Row

Just in the interest with compatibility with Excel 2007 which as
many more rows than 65500, you should use

Range(Range("A1"), Cells(Rows.Count, "A").End(xlUp)).Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"excelent" wrote in message
...
Range(("A1"), Range("A65500").End(xlUp)).Select



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



All times are GMT +1. The time now is 07:20 PM.

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"