for loop

  1. B

    Check if cell input matches another cell input from list

    I'm new to coding with excel vba, but i have an excel map with a list of superiors and a list of potential successor. Now i got the task to create an excel map where you can put in the position of a superior into an Input Box and it should automatically show you the successors that fit based on...
  2. N

    If value from range in Sheet1, is not in Sheet2, add to range in Sheet2.

    I think I am close with my code below, but it doesn't function quite as flawlessly. What I am trying to achieve is: Check to see if cell in Sheet1 range (found in column A), exists in Sheet2 column A. If cell exists in Sheet2, +1 to the value in column B If cell DOES NOT exist in Sheet2...
  3. M

    Adapting VBA Code to Exit Loop on encountered blank cell (Data Validation List)

    Hello Guys, I am using the code below to iterate through a data validation list, however in the data validation list there are a lot of blanks. I wish to stop the loop when a blank row is encountered. The code works perfect, but it keeps looping until infinity. Does anyone have an idea what...
  4. C

    copy range form one sheet to another

    Hello all, Need your help. I am unsure why the below is not working. All I am trying to accomplish is to lookup a value in column A, find that same value in Column A on a different sheet, and copy the data from the first sheet in Column G:O to the same G:O range in the second sheet... When I...
  5. N

    VBA for statement to filter

    I am needing some help figuring out my issue with the part of my VBA sub. I am new to this forum so if I did anything incorrect, please let me know. Sheet1 is a continuous list of everything being recorded and kept. Sheet2 is an updated list that is retrieved, with updated lines and new lines...
  6. C

    For loop to save time when copy data in columns range from another file worksheet

    Hi VBA experts, Could you help me to write a for loop of this code. The purpose of this vba code is search for sheets that matchs SheetName column in SourceFile, copy data until the last rows of entry in Columns Range of Source File to Destination File. I can do it without a loop as the code...
  7. A

    Copy column to range

    Hello. I would like to copy a column to another worksheet when the header matches a string input. I have the code below: Sub find_col(name As String) Sheets("name").Range("A:A").Clear With Sheets("lot") .Activate For i = 1 To .UsedRange.Columns.count If Cells(1, i).value = name Then...
  8. A

    Select range in for loop

    Hello, I have a sheet with 35 columns. I would like to create a For loop to go through all the headers of these columns, find a specific one and return the column underneath it as a Range. I have tried Dim rng As Rang With Sheets("MySheet"). UsedRange For i = 1 To .Columns.count If...
  9. A

    Speed up code: convert datetime to just date

    Hello, I am trying to convert about 75 000 lines of datetime formate data (YYYY/MM/DD HH:MM:SS) into just dates (YYYY/MM/DD). The only way I have found to do this it to concatenate the YEAR(), MONTH(), DAY() parts of the data in one column into another column. However, with so many rows, this...
  10. A

    Case inside For loop?

    Hello. I have 3 different types of data in Range("A:A") : warnings, errors, good data. The criteria that makes a value either warning, error or good is stored in cells C1, C2, C3, C4. If the value of a cell in A:A is between C1 and C2 or between C2 and C3 it is a warning. If it is greater than...
  11. N

    HOW TO USE FOR LOOP OR FOREACH LOOP TO COPY ENTIRE A COLUMN END PASTE IT TO INFINITE COLUMN

    A B C D E F G H I Z ALEX ALEX ALEX ALEX ALEX ALEX ALEX ALEX ALEX ALEX JACOB JACOB JACOB JACOB JACOB JACOB JACOB JACOB JACOB JACOB RYAN RYAN RYAN RYAN RYAN RYAN RYAN RYAN RYAN RYAN
  12. P

    Can someone tell me what's wrong with my code? For loop

    Hi, can someone have a look at the code below. It's long, but repetitive. Each IF statement works but only for the first IF comparable, and the ELSE. All of the ElseIF's don't seem to be working and I can't figure out why. Trying to spruce up the holiday tracker for my workforce. Column "AS"...
  13. H

    Exit Sub when For Condition is met

    Hi I want my code to exit as soon as the condition of the if statement within the for loop are met and the message box appears (shown in yellow below). When exit sub is added, it exits after the messagebox but the rest of my code does not run when the conditions are not met, and if I remove...
  14. Johnny Thunder

    VBA Help - If Filtered Range Return Nothing Then

    Hello all, I am having some issues with a statement in my current code and all sources online aren't really answering my question directly. I have a fairly long script that loops thru a range to get a filter criteria value and then apply the filter to a range on a seperate sheet. This code...
  15. Johnny Thunder

    VBA Help - Loop thru an array of Sheets in Workbook and extract first row to a Log Sheet

    Hi everyone! I am stuck on a task that I am not sure how to accomplish but it is pretty straightforward. My workbook has several sheets that I can put into an array that I want to extract only the first row of data E4:V4 and paste these values into Sheets("Daily Log") starting in the same range...
  16. M

    VBA: Find and Group All Occurrences of Value, Run Sub, Move to Next Group

    Hi, I need some help getting started on a code. I have a range ("B4:B") of variables that are related by the first four characters (the year). Currently an input box will appear asking which year to run the code in, and the default value is based on the left four characters of the active cell...
  17. M

    VBA: If Any Cell in a Range is Yellow Then Do Not Change Color.

    Hi, I have different ranges of cells where once a cell goes over a limit then that cell changes yellow. Once one cell changes yellow in the range I don't want the cells after to change yellow. The ColorIndex of every other cell is 24 if that's helpful. For example, in a range of F4:F7 if the...
  18. M

    VBA: Going to the next cell

    I have a range starting at B4 with term codes grouped together year and I'm trying to add the values that start with the same 4 digit year code. So 2019 should be 28,000; 2020 should be 28,500; and 2021 should be 6 (test sample). The idea is the user selects a cell and VBA will add that year...
  19. C

    Reference a radio button in an Array of Arrays with index in a For Loop

    I am trying to run some macros based on whether or not a radio button is selected. I am using a For Loop to do this, but cannot figure out how to reference the button based on where its name is indexed in an array of arrays which contain references to reports, buttons, and sheet names. Here is...
  20. R

    Hide Rows without a value

    Hello, I am trying to write a code that: Looks at cells in column A from rows 9:100 -If a cell does not have an integer then that cells entire row is to be hidden. This is what I have so far. Thank you. Private Sub CommandButton7_Click() '''''''''''''''''''''' Question Rollup Dim x As...

This Week's Hot Topics

  • separating multiple Proper names (uppercase letters) from a list
    I have a list of proper names that only has spaces between their first and last names. I need a formula that can separate these names into...
  • 'for' Loop
    Hello guys, I am trying to do something new. With the help of a VBA code, in every case, last 2 Values of last 2 cells of columns D-15 to D-28 to...
  • Open specific pdf in folder with vba
    Hi, Below is the code in use , unable to find rich icon to put code inside using a mobile. The code in use is shown below. Everything works as it...
  • What is wrong with this For Loop code?
    I am trying to loop through each cell in Column U from U4 to last row to check if the percentage in the cell is greater than -.050%. In a...
  • Data to match
    Hi there, I have created 2 worksheets with data. First is all materials used and second has the bottle type used for each of material. How can I...
  • Shifting Columns
    Hi Dear Community, I'm trying to find the best way to Shift (Cut - Paste) all the information below and to the right of the "Worker" cell in VBA...

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
Top