(Solved) – Store Target.Address in a variable

  • by
(solved)-–-store-target.address-in-a-variable

What i am trying to achieve is that a user inputs a value into column B for instance and if its below a limit (say 50) then you look at the date in column A and change the sheet tab colour of that date to red if its below 50.

However i am having issues with putting target.adress into a variable and i keep getting a type mismatch error.

This is what i have currently.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim R as integer
dim c as integer
Dim cl As Range
Dim Tb As Range
Dim RG As Range

Set RG = Intersect(Target, Range("B2:B50"))
Set Tb = Target.Address
Set r = Tb.row
Set c = Tb.column - 1
Set cl = cells(R,C).value 
Set cl = Replace(cl, "https://stackoverflow.com/", ".")

    If RG Is Nothing Then
    Exit Sub
    ElseIf Target.Value < 50 Then
       cl.Tab.Color = vbRed

        End If
End Sub

The set tb = target.address doesnt seem to work no matter what i do.

Any help is appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *