Sheet name without spaces have quotes around them- used VBA to create sheets and name based on cell value

emichan

New Member
Joined
Sep 11, 2014
Messages
22
Hi all,

I have a code that adds in n number of new worksheets and names it based on cell value. Eventually, I have a summary sheet that will perform lookups to respective sheets using indirect.

The newly created sheet names do not have any spaces in them, but for some reason the references are including single quotes. So Sheet1!B2 becomes 'Sheet1'!B2, despite the fact that "Sheet1" has no spaces.

The issue is that because the sheet names have quotes, using the original cell values (where the sheet name is taken from) will lead to a REF error once I do the indirect lookup.

I could just not use indirect and just copy/paste using vba, or add in a step so that the cell values have quotes around them, but I was curious if anyone has run into this before, and if there is a way to get around this.

Btw, the sheet names are all 4 digit numbers. The original cell values are also stored as numbers, not text, if that makes a difference.

Thank you!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You said:
I have a code that adds in n number of new worksheets and names it based on cell value.

Show us your code.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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