loops

  1. D

    Code freezing when running loops

    I have two workbooks, one with the Code INSIDE of it Sheet1 (which is the codename of the sheet I want to copy values from) and another workbook defined as "y" in this example. I want to copy over the values of cell "K1-K10" in Sheet1 into cell ("F1-F10") of workbook y (For example, I want...
  2. E

    VBA to loop through one range to find closest value in another range

    Hello. I know this has to be answered before but I couldn't find anything in the forums. What I am trying to do is this...I have two named ranges, LR and LR2, each on a different sheet. I'm trying to create a If and For loop that would go through range LR and match it with a value in LR2 IF...
  3. D

    Make VBA loop more efficient - needs to handle a lot of data

    Hi Guys, So I have a VBA macro which I can rearrange data with but need some help to make it more efficient. So i have a lot of source data (~900,000 rows), populating A2:AD900,000. My code works down column AM which is populated with names. So the code takes the name from AM2 and loops down...
  4. E

    Permutations of sets of values

    Hello, I'm a new VBA user and really need some help. I'm trying to perform pairwise permutations of an undetermined number of values entered along a single row. The permutations should be exported into columns A and B in another tab. Then I want to repeat this process for the next and all...
  5. L

    Exiting a nested for cycle

    Hello guys, I sometimes have for loops nested in for loops, but once i find my answer id like all of the loops to exit, not just the current one. My current code looks like: For Each item1 In fulllist1 For Each item2 In fullList2 If item2.Text = "hit" Then done = True...
  6. Z

    Subscript out of Range every time?

    I keep getting a "subscript out of range" error on the If statement. I've tried changing the start index to 0 and 1 and it still had this error. Sorry the codes messy, part of the reason I've been messing around with a lot of different ways to declare the array. I'm trying to alter values of...
  7. T

    Writing multiple for loops together

    Hi, I am writing a program in excel VBA where I want to write two for loops together. For example, For x = 1 to 10 and For y = 1 to 10 do something ... Next But if I write "and" between two for statements the program shows error. If I put : between the for statements or write them...
  8. H

    loop with in loops

    Sheet1 of workbook A, containes a column listing file names stored in a specific folder and two columns over the corresponding row contains a number. This number represents the number of times i need to copy and paste the data in the corresponding file onto sheet 2 of workbook A. A...
  9. T

    Range search and return

    This, I thought would be easy... I'm still very much a novice but I've been learning and I can do it with array formulas so I thought, VBA shouldn't be a problem... one whole Saturday later. I have a very large and growing range of data, Sheet("Tally"), the source And another...
  10. P

    For Each Loop and Functions

    I imagine this is painfully simple, yet all my research and trying to figure it out on my own has led to failure. I've learned how to create a button in Excel and create code in VBA to have that button change cell values. The problem is that right now I only know how to affect one cell at a...
  11. S

    Looping through all files in a directory, but open file does not loop

    Please help, my issue is that the code below works but not for active work book, so when i run the macro from the a open workbook in the same directory, it works for all the files but not for the one thats opened and im running from... i want it to run for the file thats open too. Allfolders...
  12. P

    Using an arry to index nested for loops

    When I use an array to index a set of nested for loops, I get an error ("For control variable already in use"). See this short script, for example: Sub testArrayFor() Dim myArray(1) For myArray(1) = 1 To 2 For myArray(0) = 3 To 4 MsgBox myArray(1) & myArray(0)...
  13. E

    Substring Search !

    Hello! So let's say I have: Dim MainString as string, Substring as string Dim Result as Boolean MainString ="ABCDE|ABCDF|CGHMN|QRSTU|CJKLM" Question: Is there an easier (faster) way to check whether MainString contains all elements of Substring without using loops? Example 1: If Substring...
  14. D

    Help with some code

    Hi Guys, I'm trying to rearrange some data and having trouble with getting it to correctly loop through a list. Basically I have data in columns 1-39 with no gaps. Column N contains names. I am trying to create something which takes the name on any given row (From N2 down) and searches for...
  15. A

    Nested for Loop

    I can't seem to figure out how to jump to the next "c" in the loop after pasting my data. it works the first time but does not return to the first loop to change the c value to continue the process. any help would be great Sub CopyPasteData() Dim Pool As Worksheet Dim Family As Range Dim i As...
  16. H

    Problems with offsetting loops on excel vba

    Hello everyone! I have a small piece of code that will be used to compare a column (D) with the values of columns A B and C. It will later compare the column E with B and C. One of the objectives is to compare each cell from D and E with the correspondent cells in A B and C. Example: If D1...
  17. S

    Insert Sheet Name for each cell in range

    Hello, I need help creating some code that will automatically fill in each row with the sheet name. I receive a workbook weekly, with about 50 different sheets of data I need to analyze. Doing this manually is very time consuming. Ex: Sheet1 is Named KEL01, i need KEL01 filled into every...
  18. M

    vba add-ins

    Hello. It is possible to code an Add-in that make possible to write it down, the conditions, loops and with; in other words, you know that when we type sub automatically the IDE write End Sub, so I am wondering if it is possible to write a add-in for the conditions, we just type If and the IDE...
  19. T

    Automate sparkline creation (loop help!)

    I have a spreadsheet which consists of two sheets - a summary sheet and a data sheet. On the summary sheet I have a unique list of names that exist in the data sheet in column A, and in the data sheet, there are multiple rows per name (column A) and a number next to each one which denotes...
  20. D

    Combining Do Loops with other Macros statements

    Hello all, I am looking to make 1000+ reports based on a template. I have other sheets referencing the target city to update the data they report on. I have a master macro that calls on three other macros to format accordingly and save as "Location Report- Austin 1". After creating the Austin...

Some videos you may like

This Week's Hot Topics

Top