Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to insert a column...


i need a bit of clarification with this please:

i need to select col A:B on sheet "Breakdown"
if A:B empty then insert col C from sheet "Data" into A (leaving B
empty)
but, if there's data in A:B, insert 2 columns and move A:B to the right
(so now the data from a:b will be c:d) and insert col C from sheet
"Data"

thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to insert a column...


works like a charm!

but if anyone can point out flaws, errors or corrections i'd be
greatful as well... :D

Sub IsThere()

Application.ScreenUpdating = False

Sheets("Breakdown").Select
Range("A1:B1").Select
If Selection.Text = "" Then
GoTo Insert
Else
Columns("A:B").Select
Selection.Insert Shift:=xlToRight
End If

Insert:
Sheets("Data").Select
Range("C1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Breakdown").Select
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("A:A").EntireColumn.AutoFit
Range("B2").Select

Application.ScreenUpdating = True

End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
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 Column after specific text title the new column and add for David Excel Discussion (Misc queries) 5 October 2nd 09 04:03 PM
insert a blank column between each column in a data file Holly Excel Discussion (Misc queries) 1 October 31st 07 07:04 PM
insert row / insert column command buttons fairgreen Excel Worksheet Functions 1 October 29th 07 02:41 PM
Insert blank column every other column saman110 via OfficeKB.com Excel Discussion (Misc queries) 2 August 29th 07 09:06 PM
Can't insert column PE Excel Discussion (Misc queries) 1 April 27th 07 09:51 PM


All times are GMT +1. The time now is 12:02 AM.

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

About Us

"It's about Microsoft Excel"