for each

  1. 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...
  2. 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...
  3. 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...
  4. 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 +...
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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)...
  10. 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...
  11. 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...
  12. 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...
  13. 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...
  14. 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...
  15. 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...
  16. VBE313

    Can anyone think of a better way to write this VBA or to turn it into a UDF?

    Sub test4opsgroup() Application.ScreenUpdating = False ActiveSheet.unprotect Dim cl As Object Dim l As Long, strCells As String Dim strpart As String Dim min As Range Dim numrows As Long Dim numcolumns As Long Dim partnum As Range Dim Qty As Range ActiveSheet.Range("T2").Select For Each...
  17. VBE313

    UDF For Each to end after certain range

    I was thankful enough to receive a UDF from Rick Rothstein. I was wondering if someone can help me and figure out a Do Until a certain range, I have to uses over 30 of...
  18. S

    VBA - Unable to manage 3rd loop where MsgBox works

    Hi What I am trying to do is match a team name from a cell in range "B8:J8" with a team name on a separate page in the range "C2:C337". From those matches I want to determine the highest score and return that in a cell in range B20:J20 So for each team name in B8:J8 return the highest score...
  19. Johnny Thunder

    VBA to populate a Summary based on a Matrix of Variables

    Hello All, I am working on a project that has a summary sheet with some finance categories (see sample data below) using a matrix I have defined what Cost Centers and G/L Accounts​ are used to calculate the categories total. This is simple to do on a 1 cost center & 1 G/L Account basis using...
  20. Johnny Thunder

    VBA Help - Creating Multiple Variations of the same formula based on a List

    Problem: I have a Matrix of G/L accounts & Cost Center Variables. There is a possibility of 20 Cost Centers and 20 G/L Account Combinations for each of my Categories. 1. For each category, there are a 20 Possible Cost Centers as well as 20 G/L Account variations. 2. I need a way to...

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