I'm using Excel 2010 and am trying to solve a problem. My spreadsheet contains 3 columns: Job# (column A), Process# (column B), Process Hours (column C). I want to insert a "dummy row" for each job. The dummy row will show the job#, but have static values for Process# process hours. I found a macro that goes through my data and inserts a blank row after every change of Job#. Now I need to figure out a macro that will insert the job# (copied from column A in the row below the blank row), and enter the value of 1 in Process#, and the value of 0 in the process hours column.
Here's the code I'm using to insert the blank row:
Sub InsertRows()
Dim lastRow As Long
Dim rowPtr As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
For rowPtr = lastRow To 2 Step -1
If Not IsEmpty(Range("A" & rowPtr)) Then
If Range("A" & rowPtr) <> Range("A" & rowPtr - 1) Then
Range("A" & rowPtr).EntireRow.Insert
End If
End If
Next
End Sub
Where do I go from here? How would I copy and paste the job# in column A from the next row below, and paste it in column A of the blank row? How would I insert static values in column B & C of the blank row?
Any help would be appreciated!
Here's the code I'm using to insert the blank row:
Sub InsertRows()
Dim lastRow As Long
Dim rowPtr As Long
lastRow = Range("A" & Rows.Count).End(xlUp).Row
For rowPtr = lastRow To 2 Step -1
If Not IsEmpty(Range("A" & rowPtr)) Then
If Range("A" & rowPtr) <> Range("A" & rowPtr - 1) Then
Range("A" & rowPtr).EntireRow.Insert
End If
End If
Next
End Sub
Where do I go from here? How would I copy and paste the job# in column A from the next row below, and paste it in column A of the blank row? How would I insert static values in column B & C of the blank row?
Any help would be appreciated!