Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Set Range Using Selected Cells

I have a macro that I want to execute on the cells that I have selected on a
worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell:
last selected cell) or something like that. Any suggestions? Thanks in
advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Set Range Using Selected Cells

this may do what you want if you have a contiguous range of cells selected

Dim rng As Range
Set rng = Range(Selection.Address)

--


Gary


"Paputxi" wrote in message
...
I have a macro that I want to execute on the cells that I have selected on a
worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell:
last selected cell) or something like that. Any suggestions? Thanks in
advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Set Range Using Selected Cells

have you tried...

Set myRng = Selection
--
HTH...

Jim Thomlinson


"Paputxi" wrote:

I have a macro that I want to execute on the cells that I have selected on a
worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell:
last selected cell) or something like that. Any suggestions? Thanks in
advance

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Set Range Using Selected Cells

Here is a typical format:

Sub Macro1()
Dim r As Range
For Each r In Selection
r.Interior.ColorIndex = 6
Next
End Sub


You select the cells on the sheet and the macro "does something" to them.
--
Gary's Student


"Paputxi" wrote:

I have a macro that I want to execute on the cells that I have selected on a
worksheet, that is, where 'Set myRng = Activesheet.Range(first selected cell:
last selected cell) or something like that. Any suggestions? Thanks in
advance

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
range of cells selected when I click on one Cindy Excel Discussion (Misc queries) 0 April 8th 08 08:55 PM
Put data in range of selected cells MusicMaker Excel Discussion (Misc queries) 3 September 6th 07 11:55 AM
Average Selected Cells From a Range pdberger Excel Worksheet Functions 3 July 19th 07 05:21 PM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
max/min of a selected range of cells Srikanth Ganesan[_2_] Excel Programming 1 September 1st 04 10:31 PM


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