for each

  1. K

    Duplicate values in for each

    Hi all I'm running a validation, basically checking the total amount entered per voucher no but have one small challenge left: How do I get it to do it only once per VouchNo in case of duplicate VouchNo? I hope I make some sense and there is an easy fix :-). Thanks, Kjaer Script (or at...
  2. J

    Find a Max Date based on a corresponding value VBA

    Find a Max Date based on a corresponding value VBA Find a Max Date based on a corresponding value VBA http://www.mrexcel.com/forum/newthread.php?do=newthread&f=10 Hello everyone, I'm in the process of trying to figure out how to find the max date of a value in column A. From there I need to...
  3. J

    Object Required Error 424 in For Next Cell

    Hey Guys, I'm having a hard time with a simple problem. Here is my code: Dim rptRange As Variant rptRange = Range([B1], [B21]) For Each Cell In rptRange If Cell.Value = 1 Then ' Do something End If Next The For Each Cell in rptRange throws an...
  4. J

    Deleting rows in a filtered set with For Each

    I am working on solving a problem where I get every other row deleted instead of every row. The situation is that I am using Autofilter to find empty cells in a column that shouldn't have empty cells. Before I can delete them, I need to add them to an array for exceptions handling. This means I...
  5. J

    Error-Handling for Repeat VBA Code for Multiple Values

    I think the code is fairly self-explanatory, but I'm trying to search for a number (VehNum) in a column (VehCol) and copy all of the rows with the same number in the that column to a new sheet. I'm receiving a "Run-time error 1004: Application-defined or object-defined error" in 14th line of...
  6. H

    Hide Rows inbetween two cell in one coloumn

    Hi, I am writing a VBA code to restructure the multilevel BOM dump taken out from SAP. In this data the number of coloumn's are fixed and row numbers are dynamic depending upon the size of BOM data I have finished with my code, except one part where i am stuck. I tried various things but its...
  7. K

    VBA Userform for Paychecks -- ForEach/Next issue?

    Hi all, I'm trying to set up a userform that calculates paychecks based on information already provided on sheet "Hours" regarding hours worked and wage rate. Column A contains the names -- that's what mrng refers to. After the user selects a name from a combobox on the form and enters a date...
  8. K

    For Each "Item" in Array?

    I was wondering if it is possible to use a For Each-Next construct to cycle through each element of an array, as one does with object collections? In other words, can an array and its elements be treated as objects, or is the only option to use a nested For-Next construct with the appropriate...
  9. S

    Getting Address of Current Value Throws 424 Error

    Hi Guys, I'm having a really weird problem right now. I just used a simple for each operation with an if statement wrapped inside and I want to get the corresponding row number for the value that met my condition. Set MnS = Workbooks("Metrics and Status.xls") FAlog =...
  10. A

    Macro containing For Each loop will step through correctly but won't run.

    Hello, I'm very new to VBA and decided to try and create a macro that loops through a selection of columns (in sheet "Data") and pastes them, one at a time, into a column in another sheet "CalcSheet". Once I'm successful I plan to do some work on the column while it's in sheet "CalcSheet". My...
  11. F

    Help - Combine Sheet in all file

    Hi All New to the forum, please be gentle with me... Please see the macro below I found this combine macro found on the internet, it works perfectly on its own The Macro combines all the files in a particular folder and saves it as one However, I need it to combine the files in 89 separate...
  12. M

    For Loop with Range

    Hi, I was wondering if someone could please give me a little help. I want to interate through the first column (A4:A20) and if the value of the cell is equal to a certain text then set the value of a specific variable equal to the numeric value of column B right next to that text. I know my...
  13. J

    Macro Conditional Format Help

    Hello, I am trying to pull a few different things together from different sources and getting nowhere. I need my conditional formatting to be dynamic and allow me to add rows when I need to (The in-excel version makes new rules and gets messy with conditional formatting). My understanding is I...
  14. J

    Help needed with FOR EACH CELL IN RANGE macro

    Hello, I was trying to use the reference point (moving address) of the cells that get cycled in a FOR EACH CELL IN RANGE macro. MY issue is I cannot figure out how to return the info from the cell offset from For List cell...See in red. I get a "Type Mismatch" error... Sub DCL() Dim rCell...
  15. J

    Using the cell list used in a For Each statement as a reference for another cell needed

    Hello, I have a longer code, but I'll save space. Essentially I have a "For Each rCell in Range..." code and I want to use that moving rCell as a reference to create another variable (sCell) that is used just for that one rCell, then on to the next rCell. For Each rCell In Range(Range1a...
  16. B

    Delete Columns based on Date Range

    I have a worksheet with a bunch of data and I need to delete 2 adjacent columns if their date (found in row 2) is outside of a selected range. I have it sort of working, but it is deleting every other date outside the date range. I think it has something to do with the For Each, Next coding, but...
  17. S

    Update database based on data in ListObject

    How can I create a SQL query based on the column names and values in each row? I've tried to search for a simple and free Excel based database management system, but couldn't find anything. I want to perform the action which i've tried to describe in codes below. For each row in a ListObject I...
  18. S

    For each cell in each row

    I've got some data in several columns in my sheet and want to send it to my access database. I have tried to work with following code: For Each rngRow In Worksheets("Sheet2").Range("A1:C10").Rows For Each rngCell In rngRow MsgBox rngCell.Value Next but i can't solve my problem. How can...
  19. J

    For each c, find column

    Hello, I am going through a range of cells down column A, then going across the row of that cell to determine the value inputed by user. If c.value > 0, I will copy and paste specific cells to another sheet. See code portion below: Dim TargetCell As Range Set TargetCell = Range("A6") Dim...
  20. Z

    Loop through Dates for a value

    I am having a problem I can't figure out. I have every day in a date format in Column B which I'm wanting to ONLY search for the current month and grab the values in Column F and add them, giving me a monthly total. I have this loop which only works if the 1st row is this current month. I can't...

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