This is my entire code. I am trying to make a list by moving my target cell (pastelocation). I thought I could use the range function and the .value function to move the pastelocation and paste the pertinent data, which works for the first iteration, but then when it comes to re-set the pastelocation cell, it can't because pastelocation has been changed to a 6 digit string instead of a range address. See highlighted line:
how do i just paste my variable data into my variable range address without changing the variable representing my range so that i can change my range variable properly afterwards?
VBA Code:
Dim hlevel As String, acct As String, aname As String, pname As String, pacct As String
Dim cell As Range, cells As Range, pastelocation As Range
[B]Set pastelocation = hws2.Range("A2")[/B]
hws.Range("B6").Select
Do Until ActiveCell.Value = "WW:Residence-TCard"
If ActiveCell.Value Like "[0-9][0-9][0-9][0-9][0-9][0-9]" Then
acct = ActiveCell.Value
hlevel = ActiveCell.EntireRow.Find("?*", , , , xlByRows, xlNext).Value
aname = ActiveCell.EntireRow.Find("?*", , , , xlByRows, xlPrevious).Value
[B]pastelocation.Value = acct
Set pastelocation = pastlocation.Offset(1, 0)[/B]
pastelocation.Value = aname
Set pastelocation = pastlocation.Offset(1, 0)
pastelocation.Value = hlevel
Set pastelocation = pastlocation.Offset(1, 0)
If hlevel = -4 Then
pacct = ActiveCell.Value
pname = ActiveCell.EntireRow.Find("?*", , , , xlByRows, xlPrevious).Value
End If
pastelocation.Value = pacct
Set pastelocation = pastlocation.Offset(1, 0)
pastelocation.Value = pname
Set pastelocation = pastlocation.Offset(-4, 1)
Else
hws.UsedRange.Find("?*", ActiveCell, , , xlByRows).Select
End If
Loop
how do i just paste my variable data into my variable range address without changing the variable representing my range so that i can change my range variable properly afterwards?