for loops

  1. 2

    VBA Copy Data from Sheet to Email depending on Assignee

    Hello! I currently have a Macro that creates an email for each row of data, then copies and pastes that row into the email. Each row is assigned to an individual (receiver of the email),, but sometimes, the same individual is assigned to multiple rows. I wanted to see if I could change up the...
  2. T

    "Exit For" nested in other "For Each" is breaking

    Hi, I am trying to build a Macro that searches for a term in the data across a number of worksheets (from the 2nd to the last) and for all rows that contain the search term/partial match, in any column, it returns that row to the first sheet - so it functions like a results page. I almost have...
  3. kelly mort

    loop not getting me there

    I used this code for my listbox click event. When it sends data to the textboxes, it places the data in the first column in Reg2 instead of Reg1. How do i get my data in place???? Private Sub lstWin_Click() Dim n As Integer, ac As Integer With lstWin For n = 0 To .ListCount - 1...
  4. M

    Trying to perform an action, move one cell, and do it again

    I am trying to get a macro to perform an action which finds the maximum value in one cell that translates to a minimum value in another cell. The macro works for a single cell (see code below), however, when I added in a for loop, it sets the first value to zero and then stops running. The part...
  5. B

    Simplifying my code using FOR loops

    HI, I'm new to VBA and wrote a very simple code to pull data from a survey and store it in a text file. The code is pasted below. I'd like to know if there is a way to simplify the code using For loops to step through the objTs.WriteLine commands and increment the number at the end of the...
  6. T

    Creating a Number Sequence based on a for loop.

    Hello Everyone, I am a Newby to Excel VBA and as such, not competent at all. :-) I am trying to create a number counter which runs up to a value which is determined by a COUNTIF Statement in the spreadsheet. I can get the number counter to run to the given value. However, due do formatting...
  7. J

    Sequential Summing with For Loops

    I need a way to sum the cells in a column that have been created in a variable manner. In the code I have attached I'm thinking I can insert an if statement that does this when the for loop has finished. Say the for loop runs 3 times I would need the cells in column K to sum sequentially. IE on...
  8. epslugger

    Local for loop variable and other basic questions

    Hi, I'm coding in excel 2010 and I was wondering if there is a way to create a variable that is local to a for loop. The equivalent code in c++ would be: for(int i=0; i<10; i++). I have tried the following and I get the error "Compile Error Expected: =" For i as Integer = 0 To 10 Step 1...
  9. S

    Merging two Data Sets

    The first set is 8045 rows with headers: Campus|District. The second set is 1040 rows with headers: District|City. I need to add the corresponding City to the first data set to end up with: Campus|District|City. I'm not very familiar with VBA or for loops but I think that's the route I need...
  10. H

    Question regarding for loops vs arrays

    Hello, Thanks to the members of this forum i have gone from completely clueless to beginning novice in vba. To improve, I am trying to get in the habit of creating code that is more efficient and faster. I usually create for loops to run through the data in excel to delete unwanted values...

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