Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to format some tables that I paste from qlikview in the export macro. I came up with the following script:
if CycleFlag = 1 then
'Light Brown'
XLDoc.Sheets(1).Range("A1:C22").Interior.Color = RGB(221,217,195)
'Grey'
XLDoc.Sheets(1).Range("D1:D22").Interior.Color = RGB(166,166,166)
else if CycleFlag = 2 then
'Light Brown'
XLDoc.Sheets(1).Range("A1:C62").Interior.Color = RGB(221,217,195)
'Grey'
XLDoc.Sheets(1).Range("D1:D62").Interior.Color = RGB(166,166,166)
end if
end sub
but I keep getting an error at the end sub line: "Expected 'If'". What am I doing wrong?
You don't show a sub at the beginning.
Sub SetColors()
You also don't show a definition for CycleFlag.
I have a sub at the start of the submodule. I didn't pasted the code above the part of the script that might cause problems because that part is working fine.
Apparently the problem was with the "else if" statement. I've corrected it and it's working
I don't see a problem in the script that you posted. Please post your entire script.
I have managed to fix the issue by myself. I keep forgetting that VBA syntax isn't the same as VBScript syntax, despite being similar languages