Solved

SPACE CREATION MACRO

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

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.
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 how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

829 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