Not sure what the subject is

G

GC

Hi,

I have 4 worksheets named System 1,......System 4.

The following code example has to be repeated 4 times to cover all sheets.
If Worksheets("System 1").Cells(RC, 11).Value = "" Then blah blah blah
If Worksheets("System 2").Cells(RC, 11).Value = "" Then blah blah blah
and so on

I would like to create a variable name called SheetNum and replace the
actual number 1,2,3 and 4 with this variable. I will but this in a loop
incrementing SheetNum each pass and the single line of code will cover my 4
sheets.

This is what i have tried but will not compile.
If Worksheets("System " + SheetNum + ")".Cells(RC, 11).Value = "" Then blah
blah blah

Thanks in advance for any help you can give me,
Cheers!
 
S

Sam Wilson

"System " + SheetNum is a string plus an integer, you'll get a type mismatch.

Try

"System " & SheetNum

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top