?
Solved

Select third blank cell in row

Posted on 2013-11-13
7
Medium Priority
?
322 Views
Last Modified: 2013-11-14
How do I tell this to select the third blank cell in row 4?  Then I increment the (1) it moves down another cell.  

Rows("4").SpecialCells(xlBlanks).Cells(1).Activate
0
Comment
Question by:RWayneH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 34

Expert Comment

by:Norie
ID: 39645381
Are the cells in row 4 filled with non-contiguous values?
0
 

Author Comment

by:RWayneH
ID: 39645622
yes..  2 nonblank, 2 blank, 3 non than another blank.  Also it will vary based on a download.  It could even by the first three of the row are blank... and it should pick C4.

Hope this helps. -R-
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 39647659
You can include this into a Do Loop:

Count = 0
Rows("4").Select
Do 
  For each Cell in Selection
  If cell.value = "" then count = count +1
  Col = Cell.Column
Loop Until Count = 4
  Cells(4, Col).Select

Open in new window

Thanks
Rob H

Edit:  line 7 should be: Loop Until Count = 3
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:RWayneH
ID: 39647752
Compile Error on Ln7  "Loop without Do"  Please advise and thanks. -R-
0
 

Author Comment

by:RWayneH
ID: 39647816
Here is what I came up with... is there a way to condense this down?  Your code did not work. -R-

Sub TestFindThirdBlankCell()

   Range("C4").Select
   ActiveCell.FormulaR1C1 = " "
   
   Rows("4").Select
    Do While Not IsEmpty(ActiveCell)
        ActiveCell.Offset(0, 1).Select   '(1, 0) = move down one.  0, 1 = move one right
    Loop  'ends on the blank
   ActiveCell.FormulaR1C1 = " "
'Do it again
   Rows("4").Select
    Do While Not IsEmpty(ActiveCell)
        ActiveCell.Offset(0, 1).Select   '(1, 0) = move down one.  0, 1 = move one right
    Loop  'ends on the blank
   ActiveCell.FormulaR1C1 = "Total Price"
   ActiveCell.Offset(0, 1).Select  'move one right
   ActiveCell.FormulaR1C1 = "Cost Over Base"

End Sub

Open in new window

0
 
LVL 33

Accepted Solution

by:
Rob Henson earned 2000 total points
ID: 39647968
I have now spotted the error but surprised it was reported in the way you mention.

Code should be:

Count = 0
Rows("4").Select
Do 
  For each Cell in Selection
  If cell.value = "" then count = count +1
  Col = Cell.Column
  Next Cell
Loop Until Count = 4
  Cells(4, Col).Select

Open in new window


Note addition of "Next Cell" in Line 7
Apologies,
Rob H
0
 

Author Closing Comment

by:RWayneH
ID: 39649127
Thanks worked awesome.. EXCELent!  -R-
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question