Do...while Loop: Check Until So Many Cells Have Been Marked Red

Jan 25, 2007

i'm having a bit of a issue with a do while loop. It might just be my complete lack of understanding, but i'll briefly explain what I am doing before I show you the code. I am marking cells with what I consider an invalid type for that cell red. Well unfortunatley in some sheets the number of invalid types is so high the macro crashes. So my bright idea was to inclose the check statment into a do while loop, that will only check until so many cells have been marked red. So I created a public variable, assigned it a value of 1. I then assigned the macro that marks the cell red to also take y and add 1. So in theory (mind you what I take for theroy might be in my head) it should only run until the paramaters of the do while are met which in this case are do while y < 20.

y = 1
Do While y < 20
Set MyRange = Intersect(Columns(7), ActiveSheet.UsedRange)
For Each r In MyRange
CheckDate
Next r
Loop

That is the snippet from the program calling the function, and here is the function

Public Function CheckDate()
If IsDate(r.Cells) = False And IsEmpty(r.Cells) = False Then
r.Select
MarkDate
y = y + 1
End If
If r.Cells < 1 / 1 / 1910 And IsEmpty(r.Cells) = False Then
r.Select
MarkDate
y = y + 1
End If
End Function

what i'm doing wrong here? Oh and y is assinged as a public varaible, integer data type.

View 5 Replies


ADVERTISEMENT

VBA Check If A Cell Is Empty - Move 7 Cells Over And Check Again (Loop)

Aug 10, 2012

I have data in Row 53 that spans 7 columns, but stays in the same row. I want to design a loop to select every 7th cell in that row and check if it is empty. If not, add onto a "counter" then display the final number of occupied cells (the value of the counter) at the end. This is what I have so far, but I get all sorts of errors.

Code:
Sub Tester()

Dim WB As Workbook
Dim WS As Worksheets
Dim modCounter As Long
Dim Cell As Range

Set WB = Workbook("Transverse Series.xlsm")
Set WS = WB.Sheets(BM18)

[Code] ......

View 1 Replies View Related

Loop Macro To Check If Cells Not Empty

Jun 27, 2014

Column 'N' and 'O' will be used for inputting information and will never be hidden

Column 'E' through 'F' hold information, however the user will have hidden all but one of columns 'E' through 'F' before running macro

Once the user initiates the macro, the program will detect which column in 'E' through 'F' is not hidden

The macro will then start at row one of the unhidden column and loop down looking for the text 'Req' (not including ' )

If the loop finds 'Req' it will search in column 'N' of the same row for any data at all
If it finds data in column 'N' for that particular row, it will check column 'O' of that same row for any data at all
If it finds data in column 'O' also, then all 3 parameters have been met

The loop should continue checking for these 3 items through row 500

If the loop determines that for every 'Req' found in the unhidden row there is data in the corresponding column 'N' and 'O' a message will appear that says 'Checklist Complete"

Upon closing the message box, the file should save and then exit

If the loop determines that for every 'Req' found in the unhidden row, there is not always data present in column 'N' and 'O' the message box should appear and say 'Checklist Incomplete'

In the same message box, it should provide a list under 'Checklist Incomplete' that provides the text found in column 'D' for each row where it failed the test of having 'Req' in the unhidden row and data at all in column 'N' and 'O'

That last part will give the user a tool to see where they might have forgotton to enter data.

View 3 Replies View Related

VBA To Print Marked Cells

Mar 10, 2009

If possible I want to know if the code below can be changed. At the moment it searches for cells not marked with an X and then prints the remaining cells.

View 8 Replies View Related

Delete Cells If Checkbox Not Marked

Oct 20, 2009

In Excel 2003, I have a checkbox in a cell (C15). I want a range of cells (F15:O15) to respond to this box. When the box is not checked and someone attempts to alter one of the cells in the range, I want a message box to appear, and then to have the data input in that cell removed.

The cells in the range are a mix of drop down lists using data validation and check boxes, so I need to make sure it doesn't erase those, just the choice made from the list or the mark in the box.

Possible?

View 10 Replies View Related

IF COUNTIF- To Determine That If A Range Of Cells Are Marked With An "X"

Feb 8, 2008

I am trying to determine that if a range of cells are marked with an "X", then cells containing "Pass" (A4), Pass with Opportunity for Improvement (A6)or "Fail" (A8) will be marked with an "X". I have 3 columns that are selectable for Pass, Fail, and Non-Applicable. There are a total of thirteen questions that this evaluation form asks, and the evaluator must check one box. In order to be considered a Pass, there must be more 12 or more "X"'s marked in the Pass column. A Pass with Opportunity for Improvement would be equal to 11 marked in the Pass column, and a Failure would be 10 or less showing up in the Fail column. If there is a check in the non-applicable section, this has to be figured into thye pass fail as well. A Pass would be 85% or higher, and failure anything less than this. I will attach the file for review. I would very much appreciate help on this problem first, and then there is one other element to the sheet that plays in at the end.

View 13 Replies View Related

For Loop (check The Value In Column)

Mar 18, 2009

how to write a for loop for this coding.
considering x as row,
i want to check the value in column1 for n rows.

View 7 Replies View Related

Loop And Value Enter Check - Getting Errors?

Mar 20, 2014

I have a calculation to do (see cell Q4 on image attached) where the variables to enter are s1,g1, s2,g2 etc.... In some cases I will only have s1 and g1 and the rest (s2,g2 etc...) will be zeros. As you can guess I cannot put 0's because I will get errors, however I can not either put a empty cell.

So this is why I want to create my first subroutine, where the variables will be from F5 to P5 and be able to drag down the formula to compute the same calculation for the lower rows.

View 7 Replies View Related

Check Multiple Conditions In Loop

Oct 22, 2009

I want to vary a for next loop, depending on the value of a variable (y). Is there a way of doing this without repeating code as in the example?

If y = 1 Then
For x = 1 To 100
' lengthy code changes Cells(x,1) characteristics
Next x
ElseIf y = 2 Then
For x = 101 To 200
'lengthy code changes Cells(x,1) characteristics
Next x
ElseIf y = 3 Then
For x = 201 To 300
'lengthy code changes Cells(x,1) characteristics
Next x
End If

View 9 Replies View Related

Loop Through Set Of Files And Check If File Doesn't Exist?

Feb 11, 2014

My problem is that I want to loop through a directory that contains csv files. The directory is dynamic so everytime could be a different number of files inside. I want the loop to go through each file and check if that file exists. If it doesn't to print a message that this specific files doesn't exist. Until now I got the following code:

[Code] .........

I guess I should somehow place the counter j inside the Dir path in order to check if everytime time the file[j] exists?

View 6 Replies View Related

Excel 2010 :: Loop Through To Check For All Filenames In Folder And If Then?

Dec 22, 2013

getting a function working within Excel 2010. What I'm trying to do is to first look in a specific directory and loop through each foldername then check to see if the foldername exists in column B of my worksheet. If the foldername exists then check Column E of the same row for a specific value ("assigned") and then make sure column F of the same row has no picture inside the cell. If those three things exist (column B foldername and column E "assigned" and no picture in column F), then add a picture to column F of the same row as the foldername with a hyperlink to a filename of "notes.one" in that specific folder. Then just loop through each foldername in the specific directory until all foldernames have been checked.

View 1 Replies View Related

Macro Loop To Check Several Conditions And With Variable Increments

Oct 20, 2006

Excel file attached! I need a macro to do the following:

Start with cell F4 and read the increment value from cell C4. Then add this with F3 and display the result. Continue with the same increment until it reaches the value equal to cell B4. Then read the increment from cell C5 and do the same until value equals cell B5. Repeat the same step until it reach the value equals B7. I did manually in the column F4 to F28. Moreover, the cell increment will change according to the variable in A2. In this case it is 25 and got 25 values to fill the column R.

View 8 Replies View Related

Loop Through Cells And Ranges Reverse Order With Backwards Loop

Aug 30, 2006

I am looping through each cell in a range and I would like to loop in reverse order.

Dim CELL As range
Dim TotalRows As Long
TotalRows = Cells(Rows.Count, 1).End(xlUp).Row
For Each CELL In Range("C1", "C" & TotalRows)
CELL.Select
'Code here to delete a row based on criteria
Next

I have tried:

For Each CELL In Range("C" & TotalRows, "C1")

and it does not make a difference. I need to loop in reverse order since what I am doing in the loop is deleting a row. I am looking at a cell and determining its value. If the value is so much, then the row gets deleted. The problem is that the next row "moves up" one row (taking the pervious cell's address) and therefore the For Each Next loop thinks it has already looked at that row.

View 7 Replies View Related

Copy Cells In Loop Based On Loop Increment Being Multiplied

Feb 7, 2008

I have some numbers in a column that I need to copy 12 times (each one) into another column. The problem is that I got like 200 records that will be converted in 15000 aprox. I've uploaded an example of what I need,

View 3 Replies View Related

Marked As Final, Didn't Mean To.

Jan 31, 2010

I think the title pretty much says it all... Now I have a file I can't send to anyone to do anything with... I've googled a few things but I've found nothing to work with... It was only a few hours worth of work but this seems ridiculous...

View 3 Replies View Related

Calculate Dates Marked In Calendar

Apr 12, 2009

I have a calendar in the sheet attached. If there are leave dates that are marked in red, can I create a formula to count the number of leave dates for the entire year ?

View 5 Replies View Related

Hlookup (look At The Dates In Row 2 On The Tab Marked “Cap Plan”)

Nov 17, 2009

inputting a formula that will look at the dates in row 2 on the tab marked “Cap Plan” on the sample sheet and then go to tab “Monthly Mode” and match the date and then take the percentages for each work type on that tab and put them in the percentage columns in the tab “Cap Plan” for the correct date. This document will be a rolling 52 week one so a simple = formula will not work.

View 2 Replies View Related

Syntax For Bold&Red Marked Line

Jan 27, 2009

Below is a part of my code. But I am getting error on the bold&Red marked line.

View 2 Replies View Related

Copy Marked Ranges To Another Sheet

Nov 28, 2007

I have this excel workbook that when i tick the first sheet ("251" in temp), it copys the row onto the second sheet ("order" in temp). This all work wonderful, but now if i would like to add additional pages to this excel workbook and have it do the same thing (by same thing i mean adding additional sheets but keep only one "order" worksheet and have all the information go onto the order worksheet.

So for example:

I would add an additional page name 252 into the workbook, it would look and function just like the 251. So after all the ticking on 251, all the information would go onto the "order", i can then move onto 252 and do the same type of ticking of information and those information would also continue onto "order". And i can keep adding multiple worksheet onto the workbook and do the same exact thing.

View 9 Replies View Related

Generate Calendar With Specific Dates Marked

Jan 6, 2009

I have a spreadsheet that keeps track of my travel. Column A has the date I arrived somewhere, and Column B has the date I departed, and Column C has the name of the city I went to.

I am wondering if there is a way to generate a calendar using my list that will mark those dates. For example, a calendar for the month of June 2008 that would show I was traveling from June 3 to June 14, either by marking those dates with a different color or labeling them with the city names, or even just putting an x in the box.

View 10 Replies View Related

Make A Row Disappear When Marked If The Column Is Selected?

Dec 22, 2012

I run a football sweepstake involving 120 people. Each week everyone picks a premiership team who they think is going to win. If that team loses or draws they are out. This carries on until there is one person left and they win the money. I need to make a table with all the premiership teams and names down the x and y axis. When the team is marked as "lose" everyone who has chosen that team gets deleted.

View 5 Replies View Related

Work Marked Late -Either VBA Or Worsheet Function

Dec 30, 2006

I have a very large spreadsheet with the following columns: WO# (number field); Start date (date format MM/DD/YYYY); Frequency (text); and craft (number). I am trying to have code that checks the frequency and if is "Monthly" or "Weekly" it just goes on to the next row; if it is "Annual", it adds 163 to the start date (start date needs to changed to a numeric field); if it is "Semi-annual", it adds 82 to the start date; if it is "Quarterly", it adds 45 to the start date; and so on, there about 20m different frequencies. After it adds the above value to the start date, I need to check if that number is less than today's date (the day I run the code). If it is, it needs to flagged as "LATE" and the whole row of info copied to another worksheet with LATE as the title and all the column headings and info copied to the worksheet. I hope this makes sense to someone because I am a beginner in Excel and even less informed when it comes to VBA. Any help would be greatly appreciated.

The way the process must work is that I need to check the frequency and if it is "Weekly" or "Monthly" , it is ignored and goes on to the next row. All other frequencies are cut in half, i.e., "Annual" is 183 days, "Semi-annual is 92 days", "Quarterly" is 45 days, "2-Year" is 365 days, and so on. This number needs to added to the scheduled start date (now formatted as a number, not a date, and checked to see if it is smaller than today's date (also a number). If it is, it is reported on the second worksheet (titled Late).

View 11 Replies View Related

Once The Date Is Choosen To Be Marked Somehow On A Calendar In The Same Workbook

Dec 1, 2009

I am trying to build a user form where people are filling in their holiday requests.

I need once the date is choosen to be marked somehow on a calendar in the same workbook.
Besides the date, I need in this form, people to upload a file "Holiday Request" which, after the submission of the report to be sent to a specific email, and to be stored as Object in another sheet against the name of the person who is submitting it.

View 14 Replies View Related

Macro To Insert Formula At Every Marked Cell

Jun 15, 2008

I am using a For Next statement that doesn't return the results for all the rows. The statement is as follows:

For Row = 1 To 100
If ActiveCell.Value = "CHANGE" Then
ActiveCell. Offset(0, 2).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RIGHT(""0000""&RC[-1],20)"
ActiveCell.Offset(1, 0).Range("A1").Select
ElseIf ActiveCell.Value <> "CHANGE" Then
ActiveCell.Offset(1, 0).Range("A1").Select
Else: Range("A1").Select
Exit For

End If
Next

Range("A1").Select

I hope I did that according to the rules. It only returns the result in the first cell that does have a value of "CHANGE". It seem to be going through the entire range of cells, but I'm not getting any results.

View 3 Replies View Related

Count Data (alphanumeric) Marked With Color In Table

May 11, 2013

Formula to automatically do these operations in the table below?

"column I1" contain data which I need to find in between columm B1:H1; and marked them red.

I need to do same operation for row2 to row4. I need a formula that can automatically find and mark the data in red.

I need to put a formula in B6 to count the data marked in red for column B1:B4 and do the same operation for C6,D6...H6.

A
B
C
D
E
F
G
H
RESULTS

p1
11
01
12
22
21
M1
10
11

[Code] ..........

View 9 Replies View Related

Automatically Copy Rows To New Sheet In Excel When Column Marked With X

Nov 4, 2013

Automatically copy rows to new sheet in excel when column marked with an X. If a column is marked with an X, I need to copy this row to a new sheet. So if a column C is marked with X, I need to copy this row in Sheet2 , if a column D is marked with and X, I need to copy this row below next empty row in Sheet2, if a column E is marked with X, I need to copy this row in next empty row in Sheet2.

View 2 Replies View Related

Excel 2007 :: Select And Separate Marked Values In The Sheet

Jan 7, 2014

I have spread sheet and values in some columns have highlighted in color.What I have to do is I need to quickly separate the highlighted data and put in the other spreadsheet.

View 5 Replies View Related

Automatically Copy Rows To New Sheet In Excel When Column Marked With An X

Sep 9, 2009

If a column is marked with an X I need to copy this row to a new sheet. So if a column C is marked with and X I need to copy this row to Sheet2 , if a column D is marked with and X I need to copy this row to Sheet3 and if a column E is marked with and X I need to copy this row to Sheet4., Please can someone help with the VBA code to make this work?

View 10 Replies View Related

Formatting TextBox And Check Which TextBox Is The Active TextBox In The Loop

May 18, 2006

I am attempting to format some TextBoxes from within a For/Next loop. I need a way to check which TextBox is the active TextBox in the loop. Using i as the variable, I came up with this code snippet: Me.Controls("TB" & i).Text = Format("TB" & i, "mm/dd/yy")

If i = 3, this gives me in TextBox3 (which is called TB3) the text 'TB3' and not the value of what is in TB3. It has got to bo something simple, I just can't see it!!!

View 2 Replies View Related

Check Out The Cat ID #'s In Cells

Jul 26, 2007

******** ******************** ************************************************************************>Microsoft Excel - test.xls___Running: 11.0 : OS = Windows XP (F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)boutH2I2J2K2L2H3I3J3K3L3=
HIJKLMNOPQRSTUVWXYZ1Cat*ID*#ELECTMTC*HoursInv.*Material*$Mutiplier096450965509656097510975209757098891023610673106751067610842108772108429655#N/A1.5813310317206365573396459655#N/A1402310317206365573Buchanan Survey*
[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.

This is a partial of the sheet that I am working on.

The current Formula in Column L is manually entered for each line. What I would like to know is if there is a way to have a macro that would create this formula?

What we would need it to do is check out the Cat ID #'s in cells H - J and based upon the numbers in there, look up the $ amount (right now they are in columns N-Z). The amount in column M would be manually input and then the formula in column L would be

the value in M multiplied by the sum of the values that correspond with the ID #'s in H-J plus 10.

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved