Solved

SPACE CREATION MACRO

Posted on 2014-02-20
3
191 Views
Last Modified: 2014-02-21
Reference the attached Excell file (spacingex.xlsx)

Would like to have a macro that creates 4 spaces after each DIFFERENT description listed.

Sheet 1 of the attached file has 7 different descriptions.
Other sheets that this macro can be applied will have anywhere from 2 to 15 different descriptions listed.

Sheet 1 of the attached file has the first description starting at cell location B5
Other sheets that this macro can be applied can have any starting point.

The cursor will be manually placed at the starting point, before the macro is run.

Sheet2 of the attached file shows the results of placing the cursor at B and then running the macro

MY system is Windows 8 and am running Excell 2013

                                                Tom
SPACINGEX.xlsx
0
Comment
Question by:radrick60
  • 2
3 Comments
 
LVL 59

Expert Comment

by:Saurabh Singh Teotia
ID: 39873008
Try this code..this will do what you are looking for...

Sub addspace()
Application.ScreenUpdating = False

    Dim lrow As Long, srow As Long
    Dim x As Long
    srow = 6    '<--- Your Starting Point

    Do Until srow > Cells(Cells.Rows.Count, "B").End(xlUp).Row

        If Cells(srow - 1, "b").Value = Cells(srow, "b").Value Then
            srow = srow + 1
        Else
           For x = 0 To 3
            Rows(srow + x).Insert
         Next x
            srow = srow + 5
        End If
    Loop

Application.ScreenUpdating = True
End Sub

Open in new window

0
 

Author Comment

by:radrick60
ID: 39873233
WORKED PERFECTLY!!

How do I make this macro available for all my current excell files and future files that i will create?
0
 
LVL 59

Accepted Solution

by:
Saurabh Singh Teotia earned 500 total points
ID: 39873330
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

707 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

13 Experts available now in Live!

Get 1:1 Help Now