Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default referencing worksheet as a variable

Hello, this is my first post on the website, and I am a newbie at this.
I am trying to do a couple things I guess. First of all, in a macro,
am trying to get a hyperlink to reference a worksheet in the sam
workbook. The catch is, I have a userform where you have two tex
boxes where you input someones first name and someone's last name. Th
last name is stored in a variable. I want to use that variable t
reference the new worksheet that is created with that last name as th
worksheet name.

Sub OK_Click()

Dim f As String
Dim c As String

f = First.Text 'reference to my textbox
c = Last.Text
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default referencing worksheet as a variable


activeworkbook.worksheets.add.name=c

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"crew3407 " wrote in message
...
Hello, this is my first post on the website, and I am a newbie at this.
I am trying to do a couple things I guess. First of all, in a macro, I
am trying to get a hyperlink to reference a worksheet in the same
workbook. The catch is, I have a userform where you have two text
boxes where you input someones first name and someone's last name. The
last name is stored in a variable. I want to use that variable to
reference the new worksheet that is created with that last name as the
worksheet name.

Sub OK_Click()

Dim f As String
Dim c As String

f = First.Text 'reference to my textbox
c = Last.Text



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default referencing worksheet as a variable

I guess I wasn't clear enough? Or maybe I don't understand the answe
given.

I was able to add in the sheet already (I used "Move and copy..." t
keep formatting the same.) Then I changed the name of the sheet so i
would be all uppercase. What I'm having trouble is with th
hyperlinking

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:="'UCase(c)'!A1", TextToDisplay:=UCase(c)

What do I put in the SubAddress so that the Hyperlink that is create
will have the correct reference to the sheet that I just created an
named by running the macro? I tried putting 'c' in for the workshee
name but it didn't work. Am I just missing something?

Thanks

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default referencing worksheet as a variable

Thanks Bob for helping. I actually figured this one out. Thanks agai
everyone

--
Message posted from http://www.ExcelForum.com

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
Variable cell referencing Paul Excel Worksheet Functions 1 February 16th 08 10:55 PM
Referencing tab based on Variable Chad Excel Worksheet Functions 2 June 8th 07 03:48 PM
Variable Cell Referencing 0-0 Wai Wai ^-^ Excel Worksheet Functions 3 June 16th 06 09:34 AM
Referencing Variable Name Worksheets camerons New Users to Excel 8 May 9th 05 09:57 PM
Referencing variable Lee Excel Programming 1 December 4th 03 04:07 PM


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