ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   reading cell contents in a macro (https://www.excelbanter.com/excel-programming/288467-reading-cell-contents-macro.html)

needin' help

reading cell contents in a macro
 
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!!

Rob van Gelder[_4_]

reading cell contents in a macro
 
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" wrote in message
...
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!!





All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com