Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is the code I am using.
If .Cells(x, y).Value = "." _ And counter < 6 _ And need2 0 Then .Cells(x, y).Value = "Test" Is there a way I can have the code look forward down the row to see i it can be placed 6 times? There are many reasons it could come up short, and I'm trying to avoi having an incomplete row. I want the value to appear 6 times or not a all. I would prefer the code to just continue on through the rows until i can add all 6 cells again. Thank -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hotherps,
You could use Countif to check the row If worksheetfunction.countif(Rows(1),".") = 6 then ... -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "hotherps " wrote in message ... Here is the code I am using. If .Cells(x, y).Value = "." _ And counter < 6 _ And need2 0 Then Cells(x, y).Value = "Test" Is there a way I can have the code look forward down the row to see if it can be placed 6 times? There are many reasons it could come up short, and I'm trying to avoid having an incomplete row. I want the value to appear 6 times or not at all. I would prefer the code to just continue on through the rows until it can add all 6 cells again. Thanks --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
could not get that to work.
Tried this (ugly) If .Cells(x, y).Value = "." _ And counter < 6 _ And need 0 And _ .Cells(x, y).Offset(0, 6).Value = "." And _ .Cells(x, y).Offset(0, 5).Value = "." And _ .Cells(x, y).Offset(0, 4).Value = "." And _ .Cells(x, y).Offset(0, 3).Value = "." And _ .Cells(x, y).Offset(0, 2).Value = "." And _ .Cells(x, y).Offset(0, 1).Value = "." Then .Cells(x, y).Value = "ENG" counter = counter + 1 almost worked but when cells below the range were null it threw off th row -- Message posted from http://www.ExcelForum.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This works for me
If WorksheetFunction.CountIf(.Range(.Cells(x, y), .Cells(x, y + 6)), ".") = 7 _ And counter < 6 _ And need 0 Then Cells(x, y).Value = "ENG" counter = counter + 1 End If even with empty cells -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "hotherps " wrote in message ... could not get that to work. Tried this (ugly) If .Cells(x, y).Value = "." _ And counter < 6 _ And need 0 And _ Cells(x, y).Offset(0, 6).Value = "." And _ Cells(x, y).Offset(0, 5).Value = "." And _ Cells(x, y).Offset(0, 4).Value = "." And _ Cells(x, y).Offset(0, 3).Value = "." And _ Cells(x, y).Offset(0, 2).Value = "." And _ Cells(x, y).Offset(0, 1).Value = "." Then Cells(x, y).Value = "ENG" counter = counter + 1 almost worked but when cells below the range were null it threw off the row. --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bob it does work, however I overlooked something. If the valu
"One" or "Two" is located I have to perform the same test. So if ".", "One" or "Two" is in the next 6 cells. Then that row shoul be skipped. It should move down one row and begin again. Do you know how I would do this? Thank -- Message posted from http://www.ExcelForum.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As written, it requires that "." be in each of the 6 cells plus the original
cell. You now seem to say to skip it if any of the 6 cells contain "." or "one" or "two". What conditions actually have to be met to perform the action? -- Regards, Tom Ogilvy "hotherps " wrote in message ... Thanks Bob it does work, however I overlooked something. If the value "One" or "Two" is located I have to perform the same test. So if ".", "One" or "Two" is in the next 6 cells. Then that row should be skipped. It should move down one row and begin again. Do you know how I would do this? Thanks --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I really need help with a rule | Excel Worksheet Functions | |||
If/Then Rule | Excel Discussion (Misc queries) | |||
Create a rule | Excel Worksheet Functions | |||
Validation rule | Excel Discussion (Misc queries) | |||
validation rule | Excel Worksheet Functions |