while loop

  1. F

    Find next non blank row

    How can you find the next non blank row after the active cell. Tried this. Sub test() Dim Row As Integer Dim non_blank_row As Integer Row = (ActiveCell.Row) non_blank_row = Row While WorksheetFunction.CountA(Row) = 0 non_blank_row = non_blank_row + 1...
  2. I

    while loop to count steps of inner loops

    I am writing a Sub to identify the longest Collatzs Sequenze between 1 and 1000. How do I need to implement an inner while loop to count the steps of the inner loops to identify the longest Collatz sequence? Sub LongestCollatz() Dim i As Long Dim maxSteps As Integer For i = 1 To 1000...
  3. M

    While loop to move to next row if while condition is met

    Hi Excel gurus, I have put a code together (see below - working code with no copyright, fell free to use it) that analyzes an action plan (excel file with columns for actions, date and time of begin and ending of an action etc.) and creates outlook appointments based on the information on the...
  4. B

    Selecting a Node in SAP in Excel While Loop

    This is some recorded code from SAP to select a node within a VA03/CU51 transaction. If Not IsObject(application) Then Set SapGuiAuto = GetObject("SAPGUI") Set application = SapGuiAuto.GetScriptingEngine End If If Not IsObject(connection) Then Set connection = application.Children(0)...
  5. J

    loop doubt

    Can anyone please tell me what i am doing wrong on my loop. it goes on and on until it crashes excel. i tried it in so many ways. Can you help me please. What I need it to do is to continue to find every w that is on the list. Thank you in advance Sub tentativa() Dim w As Range Dim t As...
  6. H

    How can this be looped??

    <tbody> 0down votefavorite Having a heck of a time looping this; D2 is where my list starts. I would like to have it ran for d3, d4, d5, d6.... until a blank space. This program searches for the name in Column D and if it finds it, it places it in Column E so that would need to also increase...
  7. A

    error in While loop

    I have this code, to replace specific text in all sheets in same column. It should automatically count cells in first column and accordingly run While loop. But code is not able to count number of cells everytime. in Other words variable count value is not changing Dim count As Integer For...
  8. V

    Help making a Do-While loop... Loop

    Hi all, I'm having trouble making this loop iterate: Do While Cells(96, DtlNxtCol + 2).Value > 0 Sheets("Detail_Sheet").Select Cells(10, DtlNxtCol).Copy Sheets("Summary").Select Cells(SumNxtRow, 1).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone...
  9. C

    Concatenate strings using if statements within a while loop? Please help!

    Hi guys, I've been a lurker on the forums for a while now and I've gotten some great advice on some of my questions! Thanks for all the help! :) I now have a complicated situtation that I haven't been able to find the answer to. Apologies in advance for the long post; I’m just trying to include...
  10. B

    Accumulate Sum that meets a condition

    Hi guys, I've been struggling with a macro, I'm really new at this. I'm trying to do a cumulative sum from some values at Excel spreadsheet until that variable meets a given condition. Then, when that condition is met, I want a cell of Excel to take a value of another cumulative sum. Sub...
  11. J

    How to use "Do... while/until... loop"

    I have a Macro that find a specific value in this case the word "BRILLANTE-2 (DES)", when the word is found a range is selected, cut and paste in other book. I want repeat this instruction because the word ""BRILLANTE-2 (DES)" could be more than one time in the Sheet. When the word doesn't...
  12. A

    VBA - How to assign a variable in While condition

    Hi, The boolean expression for my While statement uses a return value from a function that I also need to use from within the statement block. While ( (valueToUse=FromFunction())>-1) DoSomethingElse(valueToUse) Wend The problem can be resolved with a ByRef parameter set to the return value...
  13. R

    Looping within a cell?

    Hello everyone - I've got a cell with several words in it and I want to capitalize only the names: So, if I have a list with 3 names Greg Peter Bobby and my value in cell A1 is greg -play the guitar for peter and bobby I can probably do something like...
  14. R

    Loop: Do Until Fill Color is 16 Debug Error

    Hello everyone, I am familiar with a few coding languages, including PHP, C++, etc, however I am new to Excel and VBA. I am attempting to create a do-while/do-until loop which stays in the same column, and keeps descending row to row until it hits a Gray-filled cell, at which point it takes...
  15. F

    Navigating a spraedsheet

    macro to move around a sheet. I have some VBA code in Worksheet_Change It worked, sometimes... other times it caused Excel to go off into random orbit and I would have to kill it in Task Manager. The error message indicated a problem with .Range. The spreadsheet comprises four rows that...
  16. E

    Help writing a simple VBA loop formula please :)

    Hello I don't think there is a "while" formula allowing me to do what I want so may need VBA help! I want to make Excel understand that as long as the cells in column C are not empty, it needs to copy into cell A the value of the first non-blank cell C. For example: there is "7000" in C1. I...
  17. S

    While Loop with Type Mismatch

    I have a while loop that counts backwards in a seriescollection to find the last value with data. In one particular case, I had to use an IF formula in the source data where it would output NA() if the statment was false, so instead of loop through empty strings until the loop finds a number, it...
  18. J

    Nested Dir loops

    As I have just found out I don't think it's possible to nest Dir loops. Current code: sFile_1= Dir(sPath_Internal & "*.xls") While sFile_1<> "" ... sFile_2= Dir(sFile_1_variable & "*.xls") While sFile_2<> "" ... sFile_2= Dir sFile_1= Dir Is...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top