VBA Index Match doesn't allow spaces?

excelnoob001

New Member
Joined
Jul 24, 2019
Messages
26
Context: I am trying to automate a task through a macro. I have a source file and a destination file and dumping in specific data from the source file onto the destination file. However, since the source file has a different table layout, I created a hidden sheet in the destination file to hold this data, then transfer it to my actual sheets.

The problem is that index match is not recognizing the name of worksheets that have spaces inside of them.

Rich (BB code):
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sheets("Richmond Hill").Range("C7").Select
ActiveCell.FormulaArray = _
"=INDEX(AllGridTemp!$C$3:$C$48, MATCH(Richmond Hill!A7&Richmond Hill!B7,AllGridTemp!$A$3:$A$48&AllGridTemp!$B$3:$B$48,0))"
              Set SourceRange = Worksheets("Richmond Hill").Range("C7")
              Set fillRange = Worksheets("Richmond Hill").Range("C7:C52")
              SourceRange.AutoFill Destination:=fillRange

When I run this, I get a #NAME ? error.

Also, when I try to manually enter the formula, I get a dialog box to select a file update values.

How do I make sure the formula accounts for spaces in sheet name?

Thank you.
[/FONT]
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You need to enclose the sheet names in single quotes, i.e.
'Richmond Hill'!A7
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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