Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
repeat macro through cell until first blank
William, I'm not sure what your desired end result is. What are you trying to
accomplish and what giving you "inaccurate results"? -- Charles Chickering "A good example is twice the value of good advice." "william" wrote: I'm close, but I'm getting inaccurate results. Do you see any errors? ***** Sub Sumcharacters() Dim i As Long, s As String Dim nSum As Long Dim lSum As Long i = 1 Do Do While i <= Len(ActiveCell) s = Mid(ActiveCell, i, 1) If IsNumeric(s) Then nSum = 0 Do While IsNumeric(s) nSum = nSum * 10 + CLng(s) i = i + 1 s = Mid(ActiveCell, i, 1) Loop lSum = lSum + nSum Else i = i + 1 End If Loop ActiveCell.Offset(0, 1).Value = lSum ActiveCell.Offset(1, 0).Select Loop Until ActiveCell = 0 End Sub ***** "Charles Chickering" wrote: here's one simple way assuming your macro operates based on the active cell: Sub YourSub() Do 'YourStuff ActiveCell.Offset(1).Select Loop Until ActiveCell = "" -- Charles Chickering "A good example is twice the value of good advice." "william" wrote: I am running a macro through one specific column of my spreadsheet. From cell B4 to anywhere from B20 or higher, to be exact. I need to add something to my code so that my macro will execute in each cell moving down that column until it encounters the first blank cell. At that point it should stop altogether, doing nothing with the blank cell. Any suggestions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro - how to move to a specific cell and repeat | Excel Worksheet Functions | |||
macro to find the last blank cell in col. A | Excel Discussion (Misc queries) | |||
Copy data in one cell to blank cell immediately below, repeat | Excel Worksheet Functions | |||
Repeat Macro until Empty Cell Reached | Excel Programming | |||
Excel VBA - Repeat for loop until blank rows | Excel Programming |