Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Fill in a term above certain cells by means of a macro

Posted on 2012-12-28
2
Medium Priority
?
318 Views
Last Modified: 2012-12-29
Dear Experts:

I would like to run a macro that performs the following action:

Loop thru all the cells in Column A.
Whenever the macro hits a 1 (i.e. a cell filled with the value 1 in Column A) it should enter 'beginning' just above the cell where the value 1 is found.

Help is much appreciated. I have attached a sample file for your convenience.

Regards, Andreas

Add-Term-Above-Certain-Cells.xls
0
Comment
Question by:AndreasHermle
2 Comments
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 38727352
Sub fillbeginning()
    Dim cel As Range
    For Each cel In ActiveSheet.UsedRange.Columns(1).Cells
        If cel.Offset(1) = 1 Then cel.Value = "Beginning"
    Next cel
End Sub
0
 

Author Closing Comment

by:AndreasHermle
ID: 38728976
Fast code, exactly what I was looking for.

Thank you very much for your professional support.  

Regards, Andreas
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

972 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