Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Really easy?

Having a mind block, hoping someone can help me.
I want to be able to go to the furtherest right cell of a spreadsheet,
and then select every occupied cell in that range and run a loop over
it. I have an xlToRight code running me to the right-most cell, but I
can't sue xlDown as there are blank rows before the end. However,
selecting down to row 1600 would do the job. How can I make the
selection? The ActiveCell is Row 1 in the relevant column and I want to
select row 1 to row 1600 in this column.
Any help greatly appreciated!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Really easy?

Try this. You may have to adjust the SpecialCells line to get what yo
want (record an Edit/Goto macro).

'-------------------------------------------------
Sub SelectSpecial()
lastcol = ActiveSheet.Cells.Find(what:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
lastrow = ActiveSheet.Cells.Find(what:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
ActiveSheet.Range(Cells(1, lastcol), Cells(lastrow, lastcol)) _
.SpecialCells(xlCellTypeConstants, 1).Select
End Sub
'-------------------------------------------------

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Really easy?

With Range("A1")
Range(.Offset(0,0), .SpecialCells(xlTypeLastCell)).Select
End With

or
For Each myCell In Range(Range("A1"), _
Range("A1").End(xlToRight).Offset(1600, 0).End(xlUp))
:
Next myCell


Kevin Beckham

-----Original Message-----
Having a mind block, hoping someone can help me.
I want to be able to go to the furtherest right cell of a

spreadsheet,
and then select every occupied cell in that range and run

a loop over
it. I have an xlToRight code running me to the right-most

cell, but I
can't sue xlDown as there are blank rows before the end.

However,
selecting down to row 1600 would do the job. How can I

make the
selection? The ActiveCell is Row 1 in the relevant column

and I want to
select row 1 to row 1600 in this column.
Any help greatly appreciated!


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Really easy?

Not sure what you're asking.

dim thisColumn as Long
dim maxrow as long

maxrow = 1600
thisColumn = ActiveCell.Column


For each Cell in Range(Cells(1,thisColumn), _
cells(maxrow,thisColumn))


Next

or
WITH Range(Cells(1,thisColumn), _
cells(maxrow,thisColumn))
''' use for example
.FormulaR1C1 = .....

End With


Patrick Molloy
Microsoft Excel MVP
-----Original Message-----
Having a mind block, hoping someone can help me.
I want to be able to go to the furtherest right cell of

a spreadsheet,
and then select every occupied cell in that range and

run a loop over
it. I have an xlToRight code running me to the right-

most cell, but I
can't sue xlDown as there are blank rows before the end.

However,
selecting down to row 1600 would do the job. How can I

make the
selection? The ActiveCell is Row 1 in the relevant

column and I want to
select row 1 to row 1600 in this column.
Any help greatly appreciated!


---
Message posted 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
If/Then - EASY JRW6277 Excel Discussion (Misc queries) 2 January 21st 09 08:55 PM
This will be really easy, I'm sure Jamie Excel Discussion (Misc queries) 9 December 5th 08 05:30 PM
Easy one... NWO Excel Worksheet Functions 7 September 5th 07 04:39 PM
There must be an easy way? kassie Excel Discussion (Misc queries) 5 May 26th 07 06:33 AM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM


All times are GMT +1. The time now is 06:22 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"