Solved

Finding the first nonblank cell in a row, from a specific position.

Posted on 2014-07-24
3
149 Views
Last Modified: 2014-07-24
C.Offset(0, 5).Value = CH_FinGrp

Using this command to place a value on a sheet from within a For Selection loop.
What if the cell that this is going in is not blank?  How do I tell this to search for the first nonblank cell to the right of (0, 5) and place it there??
0
Comment
Question by:RWayneH
  • 2
3 Comments
 
LVL 32

Expert Comment

by:Rob Henson
ID: 40217114
Slightly confusing question.

What if the cell this is going in is not blank? If so, it is the first nonblank cell. Are you wanting the first BLANK cell to the right?

If so you could increase the Offset command value within a Do Loop

ColOffset = 5
Do Until C.Offset(0,ColOffset).Value = ""
ColOffset = ColOffset + 1
Loop
C.Offset(0,ColOffset).Value = CH_FinGrp

Open in new window


Thanks
Rob H
0
 
LVL 32

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 40217120
If it goes one cell too far, might have to put the Until statement after the Loop rather than after the Do

ColOffset = 5
Do 
ColOffset = ColOffset + 1
Loop Until C.Offset(0,ColOffset).Value = ""
C.Offset(0,ColOffset).Value = CH_FinGrp

Open in new window

0
 

Author Closing Comment

by:RWayneH
ID: 40217943
Worked great!!  Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now