![]() |
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 |
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 |
All times are GMT +1. The time now is 09:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com