Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default using a the active cell in a range command....

i am using a loop and active cell offset to get to the first empty cell in a
specified column.

Do
ActiveCell.offset(1, 0).Select
Loop Until ActiveCell.Value = ""

after arriving at the active cell that the loop selects, i want to use the
active cell in a range command.

Range("A10:Ai2000").Select

i want to use whatever the active cell is in place of the "A10" above.

any ideas?




--
dr chuck
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default using a the active cell in a range command....

Hi Dr Chuck,

To find the first empty cell, try:

Dim rng As Range
Dim rng2 As Range

Set rng = Range("A1").End(xlDown)(2)

To find cell after the last populated cell in column A, try:

Set rng = Cells(Rows.Count, "A").End(xlUp)(2)

To return your extended range, try:

Set rng2 = Range(rng, Range("A2000"))

Note, however, that it is rarely necessary, and usually inefficient, to make
selections. It is instead usually possible to manipulate the range object,
e.g.:

rng2.Interior.ColorIndex = 6


---
Regards,
Norman


"dr chuck" wrote in message
...
i am using a loop and active cell offset to get to the first empty cell in
a
specified column.

Do
ActiveCell.offset(1, 0).Select
Loop Until ActiveCell.Value = ""

after arriving at the active cell that the loop selects, i want to use
the
active cell in a range command.

Range("A10:Ai2000").Select

i want to use whatever the active cell is in place of the "A10" above.

any ideas?




--
dr chuck



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default using a the active cell in a range command....

thanks norman,
I will try this method
--
dr chuck


"Norman Jones" wrote:

Hi Dr Chuck,

To find the first empty cell, try:

Dim rng As Range
Dim rng2 As Range

Set rng = Range("A1").End(xlDown)(2)

To find cell after the last populated cell in column A, try:

Set rng = Cells(Rows.Count, "A").End(xlUp)(2)

To return your extended range, try:

Set rng2 = Range(rng, Range("A2000"))

Note, however, that it is rarely necessary, and usually inefficient, to make
selections. It is instead usually possible to manipulate the range object,
e.g.:

rng2.Interior.ColorIndex = 6


---
Regards,
Norman


"dr chuck" wrote in message
...
i am using a loop and active cell offset to get to the first empty cell in
a
specified column.

Do
ActiveCell.offset(1, 0).Select
Loop Until ActiveCell.Value = ""

after arriving at the active cell that the loop selects, i want to use
the
active cell in a range command.

Range("A10:Ai2000").Select

i want to use whatever the active cell is in place of the "A10" above.

any ideas?




--
dr chuck




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default using a the active cell in a range command....

probably I have not understood;l
activecell.End(xlDown).offset(1,0).Select
will take to the first empty cell (it should be really empty) in the column

if your want to select the range from the activecell upto the first empty
cell then use

range(activecell,activecell.End(xlDown).Offset(1,0 )).Select

This will select from activecell to the first empty cell.


"dr chuck" wrote in message
...
i am using a loop and active cell offset to get to the first empty cell in
a
specified column.

Do
ActiveCell.offset(1, 0).Select
Loop Until ActiveCell.Value = ""

after arriving at the active cell that the loop selects, i want to use
the
active cell in a range command.

Range("A10:Ai2000").Select

i want to use whatever the active cell is in place of the "A10" above.

any ideas?




--
dr chuck



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default using a the active cell in a range command....

Thanks for your help. I am just learning to use visual basic. So, the obvious
answers are sometimes hidden in my lack of knowledge.
--
dr chuck


"R..VENKATARAMAN" wrote:

probably I have not understood;l
activecell.End(xlDown).offset(1,0).Select
will take to the first empty cell (it should be really empty) in the column

if your want to select the range from the activecell upto the first empty
cell then use

range(activecell,activecell.End(xlDown).Offset(1,0 )).Select

This will select from activecell to the first empty cell.


"dr chuck" wrote in message
...
i am using a loop and active cell offset to get to the first empty cell in
a
specified column.

Do
ActiveCell.offset(1, 0).Select
Loop Until ActiveCell.Value = ""

after arriving at the active cell that the loop selects, i want to use
the
active cell in a range command.

Range("A10:Ai2000").Select

i want to use whatever the active cell is in place of the "A10" above.

any ideas?




--
dr chuck






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
use active cell to determine range Gizmo Excel Discussion (Misc queries) 2 March 31st 08 04:55 AM
Clearly seeing active cell in a range dsa Excel Discussion (Misc queries) 2 March 24th 08 03:22 PM
Active cell as range Patrick Simonds Excel Programming 4 May 29th 06 08:21 PM
Change active cell properties with command button Nick Excel Programming 2 January 30th 04 05:11 PM
Change active cell properties with command button Beto[_3_] Excel Programming 0 January 30th 04 04:58 PM


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