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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You need to enclose the sheet names in single quotes, i.e.
'Richmond Hill'!A7
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

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