Using Do Loops to copy data
I need a bit of code that will search through each cell in a column and look
for €śAgent Name:€ť then choose cell to its right and create a new sheet with
the value of the selected cell as the name.
Below I have added what I tried, which obviously did not work. Any help on
this would be greatly appreciated. (Note, I can make the new sheet and name
it, so my test code just had a msgbox pop up with the value for testing)
=-=-=-=-=-=-=-=
Dim rngEdit As Range
Dim trow As Integer
Dim tcol As Integer
Dim tname As String
Sub LoopIt()
trow = 1
tcol = 3
Set rngEdit = ActiveSheet.Cells(trow, tcol)
Do Until rngEdit.Value = "Agent Name:"
trow = trow + 1
Loop
tcol = tcol + 1
tname = ActiveSheet.Cells(trow, tcol).Value
tcol = tcol - 1
MsgBox trow & " " & tcol
End Sub
|