for loop

  1. B

    for loop using variable

    I am trying to use a variable to determine how many times to go thru a loop. The code that I am trying to get to work is shown below. If I use 'For S1 = 1 to 2", I go inside my loop 2 times. If I use 'For S1 = 1 to NumofTimes', I do not get inside my loop. The Msgboxes show a value of 1 and a...
  2. A

    VBA: Multiple if conditions with loop

    Dear All, I am writing a macro where i have multiple conditions for getting the data and i am stuck here as it is giving only single output that is "0-1 days"... Please help below is my code : Lastrow1 = Sheets("Rawdata").Range("A" & Rows.Count).End(xlUp).Row For A = 2 To Lastrow1...
  3. O

    Comparing Dynamically Assigned Variables In An Array

    Hello, I am writing a program that combines and compares the values in columns 1 and 2 using an array, then changes the color of the row those values appear it if it show up more than once in the spreadsheet. I know there is an easier way to do this with formulas, but the person I am making...
  4. S

    Current Macro not Looping through both variables.

    Hello guys! I have a current project where i am trying to get a macro to set E to A depending on whether or not the value in the previous row is a date. If it is i want it to simply copy down. But if the value before isnt a date i want it to change to copy and pasting the text value . Right...
  5. G

    Looping Through Select Cases

    Hello All, I have a independent combobox and a dependent combobox, the dependent combobox depends on the information provided in the first independent combobox. I know there is the select case to make fill the dependent combobox. Here is a brief overview what my code does. I have two...
  6. M

    Make For Loop Show Error Message

    Hi everyone, I can't figure out how to make my simple for loop code show an error message when it no longer finds any cell(s) that meet the criteria. The criteria is that the first cell must match "K1110" while 4 cells to it's right must be blank. Please note that this code works fine. But...
  7. C

    Loop through Multiple Worksheets, with autofilter, for different Criteria

    I've searched several forums over the last few days and have been unable to find exactly what I'm trying to do. Apologies if I missed it somewhere in this forum. Currently, I have a functioning macro that will autofilter each worksheet for the specified values from the main "input" worksheet...
  8. C

    VBA for dynamic conditional formatting.

    Hi, I need to reference a cell in Column A and B on the Active row for a conditional formatting command and am having trouble. It isn't the most glorious bit of code but it works with the exception that its hard coded to reference A2 and B2. Rather I need A and ActiveCell.row or...
  9. V

    Code explanation

    FolderLoc = FolderLoc & "" & "Jan" & ". " & Year 'Inside the Folderloc there are ten's of file and each and every files has atleast three more files in it. Set FSobj = CreateObject("Scripting.FileSystemObject") Set ProjectsFolderObj = FSobj.GetFolder(FolderLoc) For Each BCFolderObj In...
  10. J

    Loop to Ignore Hidden Rows

    Hello, I have a worksheet that's split into groups of data with a heading at the top of each. For instance, row 3 has a heading, then 4-9 have data that goes with it, then row 10 has another heading, and so on. Some of the rows of data are hidden using VBA based on certain values, leaving the...
  11. W

    If False Do Nothing

    How do you do Friends, I have a large data set and I would like to search for a keyword and update the cell 5 columns over from it. This is what I have so far: Sub Find_and_Write() Dim X As Variant, F As Range X = Application.InputBox("Enter Value") If TypeName(X) = "Boolean" Then Exit Sub...
  12. Z

    Macro to Filter each Sheet, Copy/Past all filtered data in a Summary Sheet

    OK, so I have my own code but it's causing lots of issues so I think I should start from scratch. Basically, what I need is a For Loop that cycles through all visible worksheets, filters each table on 3 criteria, then copies any results onto a summary sheet. It should NOT copy the header rows...
  13. H

    [VBA] Countif with For loop

    How to transform the code below into VBA Code (or another method)? IF(COUNTIF(Data!$1:$1,A2)=0,0,COUNTIF(Data!$1:$1,B1))+ IF(COUNTIF(Data!$2:$2,A2)=0,0,COUNTIF(Data!$2:$2,B1))+ IF(COUNTIF(Data!$3:$3,A2)=0,0,COUNTIF(Data!$3:$3,B1))+ . . ...
  14. H

    VBA - sum & countif & for loop

    Hi, Bros. I am having trouble coming up with a formula and was wondering if I could get some assistance/advice. I have 2 sheets, "Data" and "Sheet1". The sheet "Data" have 100000 rows with data from column B to column H. <colgroup><col><col span="7"></colgroup><tbody> ID1 1 1 8 2 3 2 0...
  15. J

    VBA For Loop Not Matching Dates

    In part of some code I'm working on, I'm trying to find the cell containing the first day of the previous month, then hiding everything from column U up to that column. I've attempted a number of different methods, but nothing I've tried seems to work - it doesn't give an error, just skips...
  16. J

    Run an Independent Iteration of For Loop

    I can't figure this out for the life of me. If I was to run For j = 3 to 3 everything runs perfectly. When I run the loop For j = 0 to finalrowcust -1 it adds all kinds of stuff. I've tried to run a For k = 0 to finalrowcust -1 then For j = k to k, but that didn't work. I've also tried...
  17. I

    For Loop to find Maximum value in a column

    How would you go about finding the maximum value in a column using a for loop? I want to be able to store the maximum in a variable.
  18. F

    VBA Loop to convert Different Existing Formulas to Array Formulas and Increment a Value

    Hello, I am new to VBA and have run into an issue with an array formula over 255 characters. The array formulas are different for each cell and are already present in each cell, so I would like to loop through a range, increment a number by 1, and then apply the cntrl+shift+enter to each cell...
  19. A

    VBA loop down x number of cells, move to next column and loop again

    Good Morning Everyone! I'm about 4 months into learning VBA so I'm still a beginner. I am trying to write a code and I'll do my best to explain what I'm trying to do. I have a worksheet with multiple columns of financial data going down the columns (In this case columns C,E,G,I,K....). Next to...
  20. M

    How find the sum of rows in columns with criteria?

    Hello, I have a workbook with departments and some of these departments have a grand total without the grand total. The table looks like this... <tbody> Department 58 Aqua Rec all unitspools ACCOUNT#: 1-026-58-00000-3343 MEMBER NUMBER MEMBER NAME TRN DATE 0 -30 DAYS 31-60 DAYS...

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