Please Help .... Level= Very Easy

ryancey

New Member
Joined
Oct 11, 2005
Messages
46
I've used a named range to name a new worksheet that I've created.
Now that its the new name, I need to move off the sheet to perform an action.

How do I move back to the worksheet using the newly define worksheet?
I rarely work in VBA and almost always need MrExcel forum users' help anytime I attempt to do so.

ActiveSheet.Name = Range("Customer_Selection").Value <--- this piece works
Worksheet.Range("Customer_Selection").Value.Select <---- I have no idea how to write this part.


Thank you for taking time out of your day to help another human.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi,

I think you might be looking for: Worksheets("Customer_Selection")

Then it depends on what you want to do next. Examples might be:

Code:
Worksheets("Customer_Selection").Range("A1").Value = 99

Worksheets("Customer_Selection").Range("B2").Select
 
Upvote 0
Thanks Rick.

The issue is that "customer_selection" is not really the name of my worksheet.

"customer_selection" is the name of a range that represents the new tab name.

In my case "customer_selection"="Ahold - Tops".

So I had previously used:

ActiveSheet.Name = Range("Customer_Selection").Value

to name the worksheet.

I move from that tab to copy data from somewhere else, and I need to move back to it by using "range" somehow.

But this is where I get confused.

Thanks Rick.
 
Upvote 0
Sorry, you are quite right.

If your worksheet's name is "Ahold - Tops" then use that:

Code:
Worksheets("Ahold - Tops").Range("A1").Value

Or you could say:
Code:
Worksheets(Range("Customer_Selection").Value).Range("A1").Value

Or you could give the worksheet an object name and then use that as a handle for that worksheet from then on:

Code:
    Dim ws As Worksheet
    
    Set ws = ActiveSheet
    
    ws.Name = ws.Range("Customer_Selection").Value
    
    ws.Range("A1").Value = 99
 
Upvote 0

Forum statistics

Threads
1,215,065
Messages
6,122,945
Members
449,095
Latest member
nmaske

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