Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50178

Continue VBA code to next line

$
0
0
Hi guys

I'm trying to continue a long line of selected ranges to the next, but it keeps coming up red, This is how i've written part of it (example only)

Code:

Range("D9,D10,D11,D12,D15" _
E9,E10,E11,E12,E13,E14,E15").Select

I dont know what i'm missing, Reason I have to select each one individually rather than a range is because of this type of code below:

Code:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With

This one above was a recorded macro to put a border around all the cells in a selected range, but then went red on the last 2 selections (which are not on here) So only way for it to work for me is to select each individual cell, and then run the code above. I think the last 2 lines used to say "inside horizontal & inside vertical" which is where the code stopped on the debugging.

How can something that got recorded not run again??????????


Thanks
This is being run on the 2003 version.

Viewing all articles
Browse latest Browse all 50178

Trending Articles