jeudi 23 janvier 2020

Module - If Then using current row value and look at value of a column

here is my basic code for the module

I am getting the current row and then need to look at values from then not currently selected column in that row.

So say my current selected cell is A6, i need to look at the value of E6, or if it was A7, then value of E7

Not sure how to write the if statement to read the current row and the needed column. The range select works great. just not the if then

Sub Module_1()

x = ActiveCell.Row
        If ("D" & x) = 3 Then
            Range("G" & x).Select
        Else
            If ("D" & x) = 4 Then
                 Range("J" & x).Select
            Else
                 Range("Z" & x).Select
            End If
        End If
End Sub

Aucun commentaire:

Enregistrer un commentaire