Interior.ColorIndex of a Range

Helnora

New member
Dim ws As Worksheet
Set ws = Application.Worksheets(“test”)

Set r1 = ws.Range( ws.Cells(9, 2), ws.Cells(EndRow, 20))
Set r2 = ws.Range( ws.Cells(9, 22), ws.Cells(EndRow, 26))
'Set r3 = Union(r1, r2) - this do not work…?

r1.Interior.ColorIndex = xlNone - this is not possible??
 
For the “Union” I get error when compiling.

r1.Interior.ColorIndex gives error when running the code. It just says there something wrong in the line when evaluating.
xlNone
xlAutomatic seems to be a problem.

"With …
End With "
is also not possible in the VBA compiler?

ws.Range(“B1”).HorizontalAlignment = xlLeft : "Unable to set HorizontalAlignment property of Range class when evaluating HorizontalAlignment "
 
Last edited:
Yes, a lot of Excel constants are already defined in our VBA compiler but not all. Replacing them by their real values as you suggested works.
 
Last edited:
Back
Top