0

current code is

lngLastRowDPWK = ActiveSheet.Cells(Activesheet.Rows.Count,"DX".End(xlUP).Row+3

Range("DP" & lngLastRowDPWK:"DV" & lngLastRowDPWK +2).select

I'm wanting it to highlight a few rows of in columns DP-DV but the row number is a variable. Any help is appreciated. Thank you

1 Answer 1

1
Sub test()
    'You were missing a ")"
    lngLastRowDPWK = ActiveSheet.Cells(ActiveSheet.Rows.Count, "DX").End(xlUp).Row + 3
    'You weren't creating the string correctly
    Range("DP" & lngLastRowDPWK & ":DV" & lngLastRowDPWK + 2).Select
End Sub
Sign up to request clarification or add additional context in comments.

3 Comments

Range("DP" & lngLastRowDPWK & ":" & "DV" & lngLastRowDPWK +2).select
Thank you I found that variation as well at the same time. I will use yours in my code though thanks for the help
@user3066795 - Why are you selecting the data? FYI it's best to avoid using .Select/`.Activate

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.