R
ryguy7272
I am trying to figure out a way to find the total number of items in a list,
in my case it is in Column B, insert a row in Column A, for each item in
Column B, and fill in all the spaces in column A and Column B. Most of my
code (some other stuff is irrelevant) is listed below:
Range("A1").Select
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
myRow = 2
Do Until myRow = lastcell
For I = 2 To Cells(myRow, 2) 'start counter at 2
If Cells(myRow, 1) <> "" Then
Cells(myRow + 1, 1).Select
Selection.EntireRow.Insert shift:=xlDown
End If
Next
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
myRow = myRow + 1
Loop
Last = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
Range("A2:A" & Last).SpecialCells(xlCellTypeBlanks).FormulaR1C1 =
"=R[-1]C"
Range("B2").Select
Selection.FormulaArray = _
"=IF(RC[-1]<>"""",COUNT(SEARCH(RC1,'Import Sheet'!R1C1:R65000C1)),"""")"
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("B2").AutoFill Destination:=.Range("B2:B" & LastRow)
End With
What I can’t get working is the incrementing of items in the last row in
Column A and the last row in Column B, both of which are dynamic. If Cell
B20 contains a value of 8, I would like to see the corresponding value in
Column A shift down (and blanks subsequently filled in) by 8 and Column B
shift down (and blanks subsequently filled in). Does anyone have any ideas
about this? I am almost done with this project. I told my supervisor I’d do
it because I though it was quite interesting, but not it is turning to be a
pain in the butt. Well, it is still very interesting; I just want to get
this last piece of the puzzle in place. I would sincerely appreciate any
assistance.
Cordially,
Ryan---
in my case it is in Column B, insert a row in Column A, for each item in
Column B, and fill in all the spaces in column A and Column B. Most of my
code (some other stuff is irrelevant) is listed below:
Range("A1").Select
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
myRow = 2
Do Until myRow = lastcell
For I = 2 To Cells(myRow, 2) 'start counter at 2
If Cells(myRow, 1) <> "" Then
Cells(myRow + 1, 1).Select
Selection.EntireRow.Insert shift:=xlDown
End If
Next
lastcell = Cells(Rows.Count, "A").End(xlUp).Row
myRow = myRow + 1
Loop
Last = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
Range("A2:A" & Last).SpecialCells(xlCellTypeBlanks).FormulaR1C1 =
"=R[-1]C"
Range("B2").Select
Selection.FormulaArray = _
"=IF(RC[-1]<>"""",COUNT(SEARCH(RC1,'Import Sheet'!R1C1:R65000C1)),"""")"
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("B2").AutoFill Destination:=.Range("B2:B" & LastRow)
End With
What I can’t get working is the incrementing of items in the last row in
Column A and the last row in Column B, both of which are dynamic. If Cell
B20 contains a value of 8, I would like to see the corresponding value in
Column A shift down (and blanks subsequently filled in) by 8 and Column B
shift down (and blanks subsequently filled in). Does anyone have any ideas
about this? I am almost done with this project. I told my supervisor I’d do
it because I though it was quite interesting, but not it is turning to be a
pain in the butt. Well, it is still very interesting; I just want to get
this last piece of the puzzle in place. I would sincerely appreciate any
assistance.
Cordially,
Ryan---