compile error: syntax error

Pookiemeister

Well-known Member
Joined
Jan 6, 2012
Messages
563
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Code:
Range("'Exhibit " & """I"" "'!$C$3:$D$3").clearcontents
I have a worksheet called Exhibit "I" and inside that worksheet I have various ranges that I would like cleared when this workbook opens. This is just one of many ranges I would like cleared. The above code returns a syntax error. How can I fix this issue. Thank You
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Maybe...
Code:
Worksheets("Exhibit " & """I""" & " ").Range("C3:D3").ClearContents

Based on your other post
 
Last edited:
Upvote 0
After turning on my Auto Syntax Check editor, it now displays "Compile error: Expected: list serparator or )" for the above code. I'm pretty sure it has something to do with the way the sheet is named but I have no idea how to fix this.
The code below has no problems with clearing the Range's content.
Code:
Range("'page 2'!$C$5:$D$5").ClearContents
Any help would be greatly appreciated on fixing this issue. Thank you.
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

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