?
Solved

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

Posted on 2014-07-24
3
Medium Priority
?
162 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
[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
  • 2
3 Comments
 
LVL 33

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 33

Accepted Solution

by:
Rob Henson earned 2000 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

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!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

800 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