for each

  1. P

    Counter in For Each loop

    I created a file which will calculate sales rep commission based on terms and conditions of the commission agreement. All sales rep performance data is filled in on one tab, and then through selections on drop down boxes, the file will generate the correct payout to be paid to relevant sales...
  2. larinda4

    Macro: Loop through sheets, copy and paste as values

    I have this code and I am wanting to loop through all the sheets in my workbook. I want it to unhide all rows/columns, delete all comments and copy/paste the entire sheet as values, then proceed to the next sheet. Sub xCheck() Dim ws As Worksheet For Each ws In Worksheets...
  3. E

    Next Row skips single row

    I have a data set and I am using the following for loop: For Each Row In lookupRange.Rows Debug.Print Row.Cells(10).Address If Row.Cells(10).Value < lookupValue Then Row.Cut destWorksheet.Range("A" & lastRow) lastRow = lastRow + 1...
  4. A

    Can I move cells to the right for each "/" ?

    I am making an index of a large number of files with a very long path, and I need that for each "/" each cell moves to the right. That is, if there are 3 "/" in a cell, that same cell must be moved 3 times to the right. is there a way to apply this to all my excel sheet? All help is welcome.
  5. R

    Random value must be unique depending on date range

    Hello, I have a button that creates 12 month sheets for a specific year that is entered into an inputbox. The code below enters values (coming from a master sheet list) randomly every workday per month sheet created. I would like to have only unique random values per week, and a minimum of 2...
  6. Johnny Thunder

    VBA Help - Scanning two Columns for string based on lookup table

    Hello All, I am working on a project and was hoping for some help on the final piece of this puzzle. I have a sheet Source that has two columns W or X that could contain a possible string of text that if its found I would like to place a value in column AL. I have a small lookup table on a...
  7. A

    Is there a limit to Nested If-Else-Then statements in a For Each Loop?

    Hi everyone, I'm attempting to use VBA to change the filters on two pivot tables according to current month and quarter according to a broadcast calendar. The logic for the month filter was very simple, and my code works. However, our quarters are represented on this other pivot table by...
  8. I

    Nested For Each Statement: Identifying Key words from Range within a Range

    Dear Mr Excel I would be so grateful for some help with this. I have 4 Sheets that contain data that i am trying to write a code for. MessagesSheet (Which is named "replies" followed by "date" and "time"): This contains text messages received. The data is organised as follows: Each row...
  9. J

    How do I edit rows based on criteria from an different table.

    I am working on a VBA code to do a couple things. The first is to add a new row and add the information I put into a seperate list. I want it to do this unless the Case Number and the Charge is the same. If those two things are the same then I want to fill in the rest of that row with that...
  10. C

    For each loop applying value of one cell to entire content

    I've got this set of code: Sub loopthru() Dim rng As Range Dim mycell As Range Set rng = Range("A2:A78") For Each mycell In rng Windows("wb1.xlsx").Activate mycell.Copy Windows("wb2.xlsx").Activate Range("G2").Select...
  11. C

    Find and replace from access to word

    Hi all just recently migrated to access still learning hoping somebody could point me in the right direction. So I have a table containing property serial number as well as location information for inventory purposes. What im Trying to do is figure out if theres a way to loop thru each...
  12. G

    Exclude one sheet name from "For Each ws In Worksheets"

    Hi there, I have a macro that walks through each worksheet in a workbook and gets data to collate into another workbook. I would like to add another worksheet where I will analyze the data that has been collated. How can I keep the analysis worksheet that I created after the initial macro run...
  13. Johnny Thunder

    VBA Help - For Each Loop with Large Data Set - Need an Alternative Loop

    Hello everyone, I am working on a project that will at some point get migrated into an actual database but at the moment is being managed in excel and the data has gotten really large. The Row count of the report has now hit over 300k+ across 12 columns. Unfortunately there is no way to trim...
  14. L

    For Each worksheet with If statement

    Good Day, I have read through so many posts and I'm not finding the issue that I'm struggling to solve. I am trying to include logic where my macro will stop if there is any missing data... The user, prior to running the macro, needs to move a sheet into the macro-enabled template. The sheet...
  15. D

    Addressing column header name in FOR EACH loop

    Hi, this seems a simple question, but just can't crack it. Have used plenty of FOR EACH loop within ListObjects in similar ways as the code below. However now come across a real legacy system with obscene amount of columns, making me want to address columns over header names instead of column...
  16. L

    Apply code to all but one worksheet in workbook

    I create a daily summary report each day that includes a pivot table with several worksheets based on filter pages within the pivot table. The pivot table includes a worksheet called "Executive Speeding Report" and "PT". Essentially the Executive Speeding Report worksheet contains the "raw" data...
  17. Johnny Thunder

    VBA Help - Rewrite a For Each Statement

    Hello all, I am working on a project and realized I messed up one piece of code but I was able to spot the problem. Here is what I have come up with, I have a For Each statement that scans my data and when there is a negative amount in column ("H2:H" & LastRow) process a few actions +...
  18. sdrowsick

    VBA Loop Issue

    Hello! I'm new here, so please let me know how I can best improve for future posts... My question is about a VBA loop in a file. I am trying to create a program that takes all the cells in a range (the range is a dynamic named range, but for this example, it's 269 rows and 37 columns), checks...
  19. Johnny Thunder

    VBA Help - Rewrite my Loop in a different order

    Hello All, Need some help with my loop code, currently it works great for the first loop, the issue I am having is that I am using a .Find Method to search a column for a value (Currently working great) problem is that once I Declare the found variable the code process a few updates based on...
  20. S

    Simple Loop for Formatting Headers

    Hi, Beyond new to VBA and macros. I'm trying to put together some simple code to loop through all sheets, excluding sheet 1, to format a varied range of cells in each sheet (if the cell has text, format it). I've been reading through all the forums and it seems like it should be simple. But...

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
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 "".
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