Solved

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

Posted on 2012-12-28
2
265 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 500 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

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

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

25 Experts available now in Live!

Get 1:1 Help Now