How to move to column B1 from column Z1

  • Thread starter Thread starter kiwis
  • Start date Start date
K

kiwis

Hi

my current cell is at column z1, i check for a condition,
if true then i move to column b1 to get the data, if not true, i move
to
next row & then test again.

how do i move to column b1 from column z1?

Do i use the offset function ?

Thank you for any suggestion provided.

kiwis
 
Hi Kiwis,

'---------------
my current cell is at column z1, i check for a condition,
if true then i move to column b1 to get the data, if not true, i move
to
next row & then test again.

how do i move to column b1 from column z1?

Do i use the offset function ?
'---------------

It is usually neither necessary nor desirable to select cells,

An appropriate code might be like:

'============>>
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim Rng2 As Range
Dim rCell As Range
Const vVal = 5

Set WB = Workbooks("MyBook.xls") '<<=== CHANGE
Set SH = WB.Sheets("Sheet1") '<<=== CHANGE
Set Rng = SH.Range("Z1:Z100") '<<=== CHANGE

For Each rCell In Rng.Cells
With rCell
If .Value > vVal Then
Set Rng2 = rCell.EntireRow.Cells(2)
MsgBox Rng2.Value
End If
End With
Next rCell
End Sub
'<<============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top