View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NoodNutt NoodNutt is offline
external usenet poster
 
Posts: 221
Default VBA - Modify data in selection

G'day Clay

I'm no MVP, just a thought, in your code example

Private Sub InsertDR()

Dim t As Long
Dim rainj as range
Dim ro as range
Dim rev As String

I can see the reference to "rainj", "ro" & "rev", but no reference to "t"

Is "t" meant to represent the reference to "Selekt"...??????

If so, then

Private Sub InsertDR()

Dim Selekt As Long
Dim rainj as range
Dim ro as range
Dim rev As String

If Selekt = "0" Then
For i = 1 To Selection.Rows.Count
rev = CStr(Sheet1.Cells(ro, 12).Value)
rev = rev & "(SC)"
Sheet1.Cells(ro, 12).Value = rev
Next
ElseIf CInt(Selekt) < 8 Then
rainj = ActiveSheet.Selection
For Each ro In rainj
rev = CStr(Sheet1.Cells(ro, 12).Value)
rev = rev & "(DR" & Selekt & ")"
Sheet1.Cells(ro, 12).Value = rev
Next
End If
End Sub

HTH
Mark.