reading cell contents in a macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I program a macro to read the contents of a cell:
- letters
- numbers
The last row in my spreadsheet has a value of 99999.
Need to loop until the cell value = 99999 - how do i do this?
While looping I need to take action only if a certain letter is encountered in a cell - if the letter is "J" I need to run another macro.

Is anyone able to help?

Please & Thanks!!
 
Needin',

Sub test()
Dim i As Long

i = 0
With Sheet1.Cells(1, 1)
Do Until .Offset(i, 0).Value = "99999"
If .Offset(i, 0).Value Like "J*" Then
Debug.Print "J Something"
ElseIf .Offset(i, 0).Value Like "K*" Then
Debug.Print "K Something"
Else
Debug.Print "Something Else"
End If

i = i + 1
Loop
End With
End Sub


Rob


needin' help said:
How do I program a macro to read the contents of a cell:
- letters
- numbers
The last row in my spreadsheet has a value of 99999.
Need to loop until the cell value = 99999 - how do i do this?
While looping I need to take action only if a certain letter is
encountered in a cell - if the letter is "J" I need to run another macro.
 
Back
Top