I'm having some trouble defining constants correctly.

I know the format should be this:

Const CONSTANT_NAME [As ConstantType] = value

But I'm a little unclear of how to word it. So here is the Line I need to change into a Constant. Normally I would have a BAS file do this but I can't find one (Refer to other post).

Code:

With oXLSheet.Range("A1:A10")
        .Font.ColorIndex = 50
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
End With

That's the entire section that I'm dealing with. I don't think all of it needs to be constants, but maybe it does? I'm not sure. All I know is that the tutorial helping me with creating automation suggested that I turn my Code into Late-Bound to help with compatibility issues a User might have in regards to opening Excel. As a result, I have had to drop the Excel Reference that I was using therefore, having to define my own constants. As stated previous, here and in the other Thread, I wanted to make it easier by Inserting a BAS File into a Module as suggested and provided by the Tutorial I'm using but there were x64 bit compatibility issues with that so I couldn't. If anyone could help me turn the "xlCenter" part into a Constant it would be greatly appreciated. I am very new at this and still learning so I thank you for your patience.

Thank you for taking the time to read this

Might be a bit late, try this...

''Private if it is used within your current form or public if called from other forms or sheets...

''It also seems that it will be of a type integer(number) ...

Private Const xlCenter As Long = 1 ''Your value here.

''If it is a strin...

Private Const xlCenter As String = "My Value Here"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.