We help IT Professionals succeed at work.
Get Started

Excel VBA - I'm looking for code that will loop through a column and return a value to another column if a condition is true.

jnikodym asked
Last Modified: 2016-03-02
I have data in Column H of my excel file.  I want to hit a button on the sheet that will loop through the data in column H and if the data is not blank or a zero i want the value that is in that cell to be placed in cell J1.  Then if it finds another value that is not blank or a zero i want that value place in cell J2 and so on.

If my H column looked like this:
H1 = Green
H2 =
H3 = 0
H4 = 0
H5 = Blue

I would want my J column to look like this:
J1= Green
J2= Blue
Watch Question
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE