Solved

SPACE CREATION MACRO

Posted on 2014-02-20
3
197 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

831 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