Solved

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

Posted on 2014-07-24
3
159 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
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 how to use a scrolling table in Microsoft Excel using the INDEX function.

717 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