looking for some solutions? You are welcome.

SOLVED: how to set new range variable to one cell address

DanM:

I have the code below that works (almost)

Sub Find_PhaseCode_Cell2()
    Dim rng As Range
    Dim newrng As Range
    Dim wb As Workbook
    Dim ws As Worksheet
    Set wb = ThisWorkbook
    Set ws = Sheets("Control budget ")
    With ws
        Set rng = Range("b57:b64")
        With rng
            For x = 57 To 64
                If Cells(x, 2).Value <> "" Then
                    Debug.Print Cells(x, 2).Address
                End If
            Next x
        End With
    End With
End Sub

where the debug.print statement is, i would like that to be variable newrng.

if i try to set that set newrng = Cells(x,2).address, I get an error

object required

What am I doing wrong?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent