Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Cell selection code

I have the following code to select two cells:

Set rng2 = Range(cell.Offset(0, 0).Address & ":" & _
cell.Offset(0, -1).Address)
If rng1 Is Nothing Then
Set rng1 = rng2
Else
Set rng1 = Union(rng1, rng2)
End If
End If

Next cell

This code selects a cell and the cell to its left. I also
need to select the cells one row up and one column to the
right of this cell (3 cells). I think that this code would
work for the second part of the selection I need:

Set rng2 = Range(cell.Offset(1, 1).Address & ":" & _
cell.Offset(1, 4).Address)

Is there a way to combine this line with my first code
example to be able to select all of these cells at the
same time?

Any advice would be appreciated
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Cell selection code

Don Guillett wrote:

have a look at RESIZE
cells(1,1).resize(-4,3)
as an example for 4up and 3 to the right

Perhaps it would be helpful if the OP eliminated some confusion and gave
us an example of what is to be accomplished, including an illustration
of the base cell and the desired selection.. The above, for example,
appears to be trying to refer to something "above" Cell A1.

Alan Beban
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
cell selection code NDBC Excel Discussion (Misc queries) 6 August 11th 09 06:39 AM
Limiting selection in a cell AND linking that selection to a list Lisa Excel Discussion (Misc queries) 1 July 28th 09 05:00 PM
Need Code For Selection SMILE Excel Programming 3 August 10th 04 12:34 PM
Selection code sixfivebeastman Excel Programming 3 May 27th 04 08:54 PM
code for showing userform on cell selection M P Reddy Excel Programming 3 December 14th 03 10:27 AM


All times are GMT +1. The time now is 10:12 PM.

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"