vba formula reference to unknown worksheet names

andybhoy

New Member
Joined
Mar 28, 2011
Messages
4
Hi can anyone help me with a problem I'm having around referencing unknown worksheet names. I've just started using VBA so not too clued up i'm afraid.

I currently have a user form and depending on the answers given, this creates the worksheet name. The worksheet therefore has an unknown name in my VBA coding
I then run a macro from this unknown named sheet which looks to other known named worksheets.
I then want to transfer the information from the known named worksheet back into the unknown one.

I can get the unknown worksheet name into a cell on the known named sheet, so maybe there is a way to reference the cell as the unkown worksheet name to put the information back in?

Any help much appreciated.
thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You're after a public variable my friend. ;)

Plenty of help online if you google "VBA variables". They allow the PC to remember a value that changes. :)

Code:
Option Explicit

Sub myExample()

    Dim aVariable As Variant
    
    aVariable = "Hello!"
    
    MsgBox aVariable

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top