|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Selecting a Range
I have this macro, where I want a certain range of cells to be underlined . I have this code but it seems to give me a mistake. If anyone could tell me what's wrong with it. I think Range("Ai:Ji").Select is where my mistake is. Here is part of my code:
while true Dim i As Integer i = 5 Range("Ai:Ji").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeBottom) .LineStyle = xlDot .Weight = xlHairline .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlDot .Weight = xlHairline .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlDot .Weight = xlHairline .ColorIndex = xlAutomatic End With i = i + 1 wend Thank you very much for your help. I greately apreciate it. Last edited by malb4uk : August 29th, 2003 at 11:52 AM. |
|
#2
|
|||
|
|||
|
You are correct, your problem is with the range. There are two ways you can select the range:
Code:
Range(Cells(i, 1), Cells(i, 10)).Select or you can also do this: Code:
dim varRangeSelect as Variant varRangeSelect = "A" & i & ":J" & i Range(varRangeSelect).Select Michael Pepera |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Selecting a Range |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|