Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting a range when value is given


If cell a1 has the value:

b2:b6

How can I assign rng1 to have this value so that I can give a command.

rng1.select
selection.copy

range("z1").pastespecial xlvalues

Is it something like

set rng1 = range("a1").value

or something along these lines?


--
ianripping


------------------------------------------------------------------------
ianripping's Profile: http://www.excelforum.com/member.php...fo&userid=3209
View this thread: http://www.excelforum.com/showthread...hreadid=400731

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Setting a range when value is given

Put this in a general module:

Sub copy()
Dim rng1 As Range
Dim mycell As String
mycell = Range("A1").Text
Set rng1 = Range(mycell)
rng1.copy Destination:=Range("Z1")
End Sub

Mike F
"ianripping" wrote
in message ...

If cell a1 has the value:

b2:b6

How can I assign rng1 to have this value so that I can give a command.

rng1.select
selection.copy

range("z1").pastespecial xlvalues

Is it something like

set rng1 = range("a1").value

or something along these lines?


--
ianripping


------------------------------------------------------------------------
ianripping's Profile:
http://www.excelforum.com/member.php...fo&userid=3209
View this thread: http://www.excelforum.com/showthread...hreadid=400731



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Setting a range when value is given

Ian,

I've added a qualifier here for the sheet too:

Sub SelectiveCopyValue
Dim rngCopy as Range
With Sheets(1)
set rngCopy = .Range(.Cells(1,1).Value)
'OR set rngCopy = .Range(.Range("a1").Value)
rngCopy.Copy
.Range("Z1").PasteSpecial xlValues
End With

Robin Hammond
www.enhanceddatasystems.com

"ianripping" wrote
in message ...

If cell a1 has the value:

b2:b6

How can I assign rng1 to have this value so that I can give a command.

rng1.select
selection.copy

range("z1").pastespecial xlvalues

Is it something like

set rng1 = range("a1").value

or something along these lines?


--
ianripping


------------------------------------------------------------------------
ianripping's Profile:
http://www.excelforum.com/member.php...fo&userid=3209
View this thread: http://www.excelforum.com/showthread...hreadid=400731



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Setting a range when value is given


Thanks this is grea

--
ianrippin

-----------------------------------------------------------------------
ianripping's Profile: http://www.excelforum.com/member.php...nfo&userid=320
View this thread: http://www.excelforum.com/showthread.php?threadid=40073

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
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
VBA setting Range Jeff Excel Discussion (Misc queries) 1 December 2nd 05 07:36 PM
Need help setting a range GettingThere Excel Programming 7 August 4th 05 10:02 PM
Setting a Range Tempy Excel Programming 6 June 15th 04 03:46 PM
range setting Mike Harris Excel Programming 5 November 22nd 03 05:07 AM


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