PC Review


Reply
Thread Tools Rate Thread

define worksheet content in VBA

 
 
Grey
Guest
Posts: n/a
 
      30th Aug 2004
I need to define a variable name for a worksheet. I want to define A12000
as "ABC" variable.
how to do it in VBA??

MIllions thanks


 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      30th Aug 2004
I just recorded this
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/30/2004 by Don Guillett
'

'
Range("C28").Select
ActiveWorkbook.Names.Add Name:="abc", RefersToR1C1:="=Sheet1!R2C3:R8C4"
End Sub

Or, another way
Sheets("sheet1").Range("a1:a6").Name = "xyz"


--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Grey" <(E-Mail Removed)> wrote in message
news:OEej%(E-Mail Removed)...
> I need to define a variable name for a worksheet. I want to define

A12000
> as "ABC" variable.
> how to do it in VBA??
>
> MIllions thanks
>
>



 
Reply With Quote
 
Nick Hodge
Guest
Posts: n/a
 
      30th Aug 2004
Don could well have understood your post correct by I read it slightly
differently. That is you want to assign a range to a variable not a range
name. If this is the case you can 'pick the bones' from the code below.
(The trick to assigning an object variable is that it must be 'Set'. (The
mywks variable is not necessary but if you are going to move sheets during
the code it is best to assign that too)

Sub assignVariable()
Dim myWks As Worksheet
Dim ABC As Range
Set myWks = Worksheets("Sheet1")
Set ABC = myWks.Range("A12000")
ABC.Select
End Sub

Hopefully between Don and myself, you have an answer


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(E-Mail Removed)HIS


"Grey" <(E-Mail Removed)> wrote in message
news:OEej%(E-Mail Removed)...
>I need to define a variable name for a worksheet. I want to define A12000
> as "ABC" variable.
> how to do it in VBA??
>
> MIllions thanks
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA function to define name in a worksheet Clinton W Microsoft Excel Misc 2 12th May 2010 08:43 AM
Define a name local to a worksheet Rich Davies Microsoft Excel Programming 3 14th Sep 2009 01:49 PM
how can i define initial worksheet =?Utf-8?B?TWlxdWVpYXMgTHVjYXM=?= Microsoft Excel Programming 1 20th Sep 2005 06:51 PM
How do I define an outside worksheet in a formula? =?Utf-8?B?ZGlsb2dkcA==?= Microsoft Excel New Users 0 3rd Nov 2004 06:19 PM
Re: Record Worksheet Content as Macro and Execute from another Worksheet David McRitchie Microsoft Excel Programming 2 23rd Jul 2003 09:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:01 PM.