Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 100
Default How to insert columns aftre each column of data

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to insert columns aftre each column of data

Group the worksheets that should have this done to them.
Click on the first tab and ctrl-click on subsequent.

Then run a macro:

Option Explicit
Sub testme()

Dim wks As Worksheet
Dim iCol As Long
For Each wks In ActiveWindow.SelectedSheets
With wks
For iCol _
= .Cells.SpecialCells(xlCellTypeLastCell).Column To 1 Step -1
.Columns(iCol).Insert
Next iCol
End With
Next wks
End Sub

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

vcff wrote:

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How to insert columns aftre each column of data

ps. remember to ungroup the sheets when you're done.

Rightclick on one of the selected sheets and choose Ungroup Sheets.

vcff wrote:

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 100
Default How to insert columns aftre each column of data

Hi Dave,

Thanks for the reminder.

vcff

"Dave Peterson" wrote:

ps. remember to ungroup the sheets when you're done.

Rightclick on one of the selected sheets and choose Ungroup Sheets.

vcff wrote:

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default How to insert columns aftre each column of data

Try this simple macro:

Sub column_adder()
Application.ScreenUpdating = False
Dim r As Range
For i = Columns.Count To 2 Step -1
Set r = Columns(i)
r.Select
If Application.WorksheetFunction.CountA(r) 0 Then
Selection.Insert Shift:=xlToRight
End If
Next
Application.ScreenUpdating = True
End Sub

--
Gary''s Student - gsnu200794


"vcff" wrote:

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 100
Default How to insert columns aftre each column of data

Hi Gary

Thanks, it works and save me lot of time to insert col by col.



"Gary''s Student" wrote:

Try this simple macro:

Sub column_adder()
Application.ScreenUpdating = False
Dim r As Range
For i = Columns.Count To 2 Step -1
Set r = Columns(i)
r.Select
If Application.WorksheetFunction.CountA(r) 0 Then
Selection.Insert Shift:=xlToRight
End If
Next
Application.ScreenUpdating = True
End Sub

--
Gary''s Student - gsnu200794


"vcff" wrote:

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default How to insert columns aftre each column of data

You are very welcome !
--
Gary''s Student - gsnu200794


"vcff" wrote:

Hi Gary

Thanks, it works and save me lot of time to insert col by col.



"Gary''s Student" wrote:

Try this simple macro:

Sub column_adder()
Application.ScreenUpdating = False
Dim r As Range
For i = Columns.Count To 2 Step -1
Set r = Columns(i)
r.Select
If Application.WorksheetFunction.CountA(r) 0 Then
Selection.Insert Shift:=xlToRight
End If
Next
Application.ScreenUpdating = True
End Sub

--
Gary''s Student - gsnu200794


"vcff" wrote:

Hi All

I need to insert blank columns after each column of data on several
worksheets.
Can help?

Thanks in advance.

vcff

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 471
Default How to insert columns aftre each column of data

This macro would work.

Sub InsertCols()
'assume that a column has data if there is something in row 1
Range("IV1").End(xlToLeft).Select
Let Y = ActiveCell.Column 'there are Y # of columns to insert
For X = 1 To Y
Columns(X + X).Select
Selection.Insert Shift:=xlToRight
Next

End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
can't insert a column, can't shift columns off the sheet. Janis Excel Discussion (Misc queries) 4 July 25th 07 07:26 PM
insert is deleting column data dunskii Excel Discussion (Misc queries) 3 September 28th 06 09:49 PM
unable to insert columns in excel, insert- columns (disabled) iam_leearner Excel Discussion (Misc queries) 1 August 13th 06 02:26 PM
insert a blank row after data changes in a column cyndi Excel Discussion (Misc queries) 2 October 24th 05 02:46 PM


All times are GMT +1. The time now is 07:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"