1. L

    Check value exists update it or add it

    Hi Everyone, I have issue with VBA with For next loops and verifying data. Right now this macro does 2/3 of what I want, but I cannot get it to add the row on the end if it does not find it. My goal is to check wb2 column "k" values against wb1 column "k" values and update if its their, and...
  2. J

    Macro Help

    Hi all, I need help with an excel macro. I have only started to use macros and as a result have a very basic knowledge and understanding. I was wondering is it possible to create a macro that can be reused even when the raw data coming in changes the position of the cell that the macro was...
  3. B

    Loop not working in VBA post i value 1482

    Sub Case_Automation() Dim a As Long Dim b As String Dim c As Long Dim d As Long Dim e As Long Dim f As Long Dim g As Long Dim h As Long Dim z As Long Dim j As Long Dim k As Long For z = 10 To 50003 a = Cells(z, 8).Value b = Cells(z, 27).Value c = Cells(z, 14).Value d = Cells(z, 18).Value e...
  4. dreen

    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...
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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...
  10. 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...
  11. 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...
  12. 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...
  13. 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...
  14. 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...
  15. 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)...
  16. 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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...

Watch MrExcel Video

This Week's Hot Topics

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