S
Spencer Hutton
i have this code, that selects a range which may be contiguous, or not
depending on what you select in the listbox.
Private Sub OKButton_Click()
Dim RowRange As Range
Dim Rng As Range
Dim RowCnt As Integer
Dim r As Integer
RowCnt = 0
For r = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(r) Then
RowCnt = RowCnt + 1
If RowCnt = 1 Then
Set RowRange = Range("MyRange").Rows(r + 1)
Else
Set RowRange = Union(RowRange, Range("MyRange").Rows(r + 1))
End If
End If
Next r
If Not RowRange Is Nothing Then RowRange.Select
Unload Me
End Sub
what can i add to it to make it change the 8th column to the value "A" in
the selected ranges only?
TIA
depending on what you select in the listbox.
Private Sub OKButton_Click()
Dim RowRange As Range
Dim Rng As Range
Dim RowCnt As Integer
Dim r As Integer
RowCnt = 0
For r = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(r) Then
RowCnt = RowCnt + 1
If RowCnt = 1 Then
Set RowRange = Range("MyRange").Rows(r + 1)
Else
Set RowRange = Union(RowRange, Range("MyRange").Rows(r + 1))
End If
End If
Next r
If Not RowRange Is Nothing Then RowRange.Select
Unload Me
End Sub
what can i add to it to make it change the 8th column to the value "A" in
the selected ranges only?
TIA