elcid113002
Technical User
Private Sub FixData2_Click()
Dim KNum
Dim LNum
Dim MNum
Dim PNum
Dim RNum
Dim TNum
Dim Counter
Dim Check
Check = True: Counter = 0
KNum = Range("N2").Value ' Should be equal to "2".
LNum = Range("N4").Value
RNum = Range("N12").Value
If KNum = 2 Then
Range("K" & RNum).Select
ActiveCell.Activate
ActiveCell.Value = Worksheets("Data").Range("J2").Value
End If
Do 'Outer Loop
Do While Counter < LNum ' Inner loop - runs until the number reaches the
' number equivalent to total number personnel on det.
Counter = Counter + 1 ' Increment Counter.
If Counter = LNum Then ' If condition is True.
For PNum = RNum To RNum + (LNum - 1)
If KNum = 2 Then
For MNum = 2 To LNum
If Sheets("Data").Range("J2") <> "" Then
Range("K" & PNum).Value = Sheets("Data").Range("J" & MNum)
End If
Next
End If
Next
Check = False
Exit Do ' Exit inner loop.
End If
Loop
Loop Until Check = False
Range("A1").Select
End Sub
I am no programmer, but I am the closest thing to it in my office.
My problem is: I need K58 = J2, K59 = J3, K60 = J4, etc... instead when I run the code I get K58 through K69 all equal "J13".
Can anyone help?
Dim KNum
Dim LNum
Dim MNum
Dim PNum
Dim RNum
Dim TNum
Dim Counter
Dim Check
Check = True: Counter = 0
KNum = Range("N2").Value ' Should be equal to "2".
LNum = Range("N4").Value
RNum = Range("N12").Value
If KNum = 2 Then
Range("K" & RNum).Select
ActiveCell.Activate
ActiveCell.Value = Worksheets("Data").Range("J2").Value
End If
Do 'Outer Loop
Do While Counter < LNum ' Inner loop - runs until the number reaches the
' number equivalent to total number personnel on det.
Counter = Counter + 1 ' Increment Counter.
If Counter = LNum Then ' If condition is True.
For PNum = RNum To RNum + (LNum - 1)
If KNum = 2 Then
For MNum = 2 To LNum
If Sheets("Data").Range("J2") <> "" Then
Range("K" & PNum).Value = Sheets("Data").Range("J" & MNum)
End If
Next
End If
Next
Check = False
Exit Do ' Exit inner loop.
End If
Loop
Loop Until Check = False
Range("A1").Select
End Sub
I am no programmer, but I am the closest thing to it in my office.
My problem is: I need K58 = J2, K59 = J3, K60 = J4, etc... instead when I run the code I get K58 through K69 all equal "J13".
Can anyone help?