?
Solved

SPACE CREATION MACRO

Posted on 2014-02-20
3
Medium Priority
?
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 39873330
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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.

765 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