for each

  1. 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...
  2. 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...
  3. 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...
  4. 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...
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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 +...
  10. 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...
  11. 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...
  12. 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...
  13. Johnny Thunder

    VBA Help - If Cell Contains Partial String Then.......

    Hello all, Have a question that I thought I could easily answer but for whatever reason it doesn't seem to be working so another pair of eyes may help. I have a For Each Cell in Range Statement that looks at a Doc Type (2 Digit Variable) and when it finds "KR" to Search a Offset Cell for...
  14. C

    VBA Find variable in another set of variables

    I have 2 lists of data and I need excel to go through one list and search for the contents of each cell in the other list and when it finds it, to then copy the cell next to it. I've started with... Sheets("Example").Select MyARange = "A1:A134933" For each MyACell in Range(MyARange)...
  15. J

    Multi Range, Multi Criteria Search VBA - Hide/Unhide Columns

    Hi All, Have a worksheet with a lot of data and I'm building a search VBA that hides/unhides columns based on 2 cells containing user entered data (from drop down menus). The first "For" function works without a problem, its easy since it's reading from a range with a single row, the second...
  16. Johnny Thunder

    VBA Help - Cell1 = Cell2 But if Cell 1 is blank return blank - Excel 2016

    Hello! I am kinda stuck on something so I will explain what I am doing. I have a Form that looks kinda like a Web portal with 18 fields/dropdowns that a user can populate. This tool also has the ability to recall these fields if the user knows the tracking number, then all the fillable...
  17. Johnny Thunder

    VBA Help - Combine 2 Macros in One - Excel 2016

    Hello All, I am working on a piece of code that loops through a range of cells and builds a Cell with data. I have the code working fine but I was not sure how to write the code in a way that I could have the code do 4 loops with varying column placement (C = #) . So as a workaround, I just...
  18. Johnny Thunder

    VBA Help - How to update Range based on Filtered Criteria - Excel 2016

    Hello All, I have come to a spot in this code that I am not sure how to tackle. I will do my best to explain what the problem is, I have one code that is able to be triggered from 3 different sheets, the outcome for all three sheets is the same, the only thing that varies is the data that...
  19. Johnny Thunder

    Vba Help - For Loop to enter Text into Cell - Excel 2016

    Hello all, I am working on a project and I have gotten fairly far with this and needed some guidance and possibly some revisions to my code to make it faster and shorter. Objective: 1. I have a Master Data Sheet (Ws2) that has 17 rows of data Columns("B:O"). Thru a loop on Column B, if the...
  20. 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...
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

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