for loop

  1. A

    VBA Speed question - one huge array (400000 rows) vs reading every k-th row

    Hello, I was wondering, is it more efficient to: grab huge range A1:M400,000 into an Array 1, create a new subArray 1 to use, from Array 1 in VB (every 12th row) OR loop through range with "i = i + 11" every time, creating a subArray 1 this way? I'm thinking it has to be 1 but do we know...
  2. P

    VBA Working between Worksheets

    I am just learning the ropes of VBA and have the following problem I am trying to work through. I am able to handle the first two requests, but am struggling to understand the best way to incorporate loops and working between values in one worksheet in order to populate cells in another...
  3. I

    Hlookup in a for loop to another workbook

    Hi MrExcel, I want to hlookup a range of values from one workbook to another. I the looked up values to be actual numbers instead of formulas. I can get it to work without a loop, but as soon as I add the loop, it won't work. Can anyone see what is wrong from the code below? myFileName =...
  4. philfriday

    Complex data transfer from one workbook to another

    Hi guys, I have two workbooks (different files) that I need to feed information from one to another. The source has different funds (European Growth Portfolio, etc.) listed horizontally and products (Ultra 75/75 Series, etc.) listed vertically. The intersections contain add if they need to be...
  5. S

    Run Loop other than the selected sheets

    Hi Experts I am new here and trying to learn things by looking at experts and need your help to get my code corrected. I have created a vba code using loop - For / next code which is working fine when i use only one sheet name which doesn't need to get summarized like below: For Each w In...
  6. E

    make shorter code

    Hello people, I have made a very long code.... But I want to make it shorter, but I don't know how... I got thoughts about create a kind of an array/case/for loop instead, have someone a suggestion how to make this code shorter? Sub GetColData() 'This function Get all the column data from the...
  7. Z

    Make Loop Faster / Loop Returns a Multiple Selection

    Hi, I couldnt find in the internet a loop that returns a multiple selection. Private X0, Y0, Lx, Ly, Atotal As Integer 'X0 = Position of the first cell in the first machine on Monday 'X0 = Position of the first cell in the first machine on Monday 'Lx = Widht, in cells...
  8. T

    For...Next Statement won't accept datatype argument

    I'm new to programming and want to make a For loop that selects cells based on the counter: For indexA = 1 to 10 Range(cells(indexA, indexA + 3)).Select ... Next indexA The debugger flags the second line saying "Method 'Range' of object '_Global' failed." I thought maybe...
  9. M

    "On Error" Statement nested in for loop

    Hello, I'm new to VBA Programming, but my first program may be a little more complicated than I can handle. Here is a segment from my code: On Error GoTo Error_Handler For i = 2 To top With Range("I" & i + 57) .Formula = "=VLOOKUP(H" & i + 57 & ",F$59:G$" & top + 57 & ",2, FALSE)"...
  10. C

    VBA For Loop Ignores Condition

    wtf???
  11. T

    2nd For loop is not running, trying to filter by zip code copy and paste to new sheet

    I'm trying to take data from a previous sheet and trying to filter it by zip codes by going row by row. I'll copy the selected row that fit the right zip code and paste it onto a new sheet. However, my 2nd for loop is not running after the first. Since I'm new to VBA I'm not sure if I'm ending...
  12. M

    Having issue in setting-up a "For Loop" code

    Dear experts, Am trying to build a small utility which extracts the status from a mainframe application.. This is the first time am attempting to write a VBA macro, so pls help. Managed to write a code as below and this works fine for the first record where, 1. It picks the REF, 2. inputs in...
  13. L

    VBA Evaluate and Sum

    Hello, My data is set up as can be seen at the bottom. In VBA I am trying to evaluate column "Prodcut" for the value Product2, and in the if Product2 is in column Product I would like to sum the numeric values listed in column "Nov14" for the rows that correspond to the Prodcut2 values and...
  14. T

    VBA Macro - For Loop with MonthName function in order to increment a variable

    Hello everyone, first post in the community, I hope I will do this correctly :) I have been trying to develop a macro that gives prices and quantities of material based on a user input (the first month [1 for January etc] and the amount of months required using the principle of a rolling 12...
  15. F

    For loop step back

    Hi, I have loop: For j = 10 to 500 x= ws.Range("C" & j).Value If x = 0 Then ws.Range("A" & j ).Select Selection.EntireRow.Delete End if next Example: j = 10 x = 0 Row is deleted, but code should once again check j=10, because when row is...
  16. dmqueen

    Type Mismatch Error when Long = 0 in For loop

    Good Morning,I am receiving a type mismatch error I cannot resolve. Any help would be greatly appreciated. :)It occurs when it enters a For loop for the last control, when the loop control = 0. Code below:I even tried recasting as a Variant, but it didn't help. I have marked the line with an...
  17. J

    For loop to find values on a webpage from label array returning 0

    Hi All, I'm hoping you could help me with an issue I've been having while trying to search for values from a label array on a webpage. What I'm trying to do is find a value from a label on a userform on a webpage and then have it display the results back on the userform. The loop seems to work...
  18. D

    Custom function with small array and for loop -- really slow, keyboard input hangs?

    I'm relatively new to writing VBA, but have been lurking on the site for most of that time. There are quite a few helpful threads on here -- so to start off, I'd like to say thank you to all of the contributors! I've been working on a custom function to calculate income tax. I have two...
  19. 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...
  20. J

    If equals formula not working as expected

    Newish to VBA and have stumbled into a problem I can't crack myself. What the code should do: I have a series of list box (eTag1) items contained within a cell, which are comma delimited. I use the Split function and then two For loops to run through each of the items in the cell and compare...

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