Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Columns based on cell value
Hello!
Could you please tell me how (in a macro) to insert multiple blank columns based on the value of a cell. Example: if A1=2, then insert 2 columns...a new B & C column. Example: If D1=4, then insert 4 columns...a new E, F, G & H column. Your help would really be appreciated. Thank you, Jill |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Columns based on cell value
put the foolwoing code in the worksheet module
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row = 1 And IsNumeric(Target.Value) Then If Target.Value 0 Then Range(Cells(1, Target.Column + 1).Address, Cells(1, Target.Column + Target.Value).Address).EntireColumn.Insert End If End If End Sub - Mangesh --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert an image based on a cell value | New Users to Excel | |||
Insert value based on color of the cell | Excel Worksheet Functions | |||
Insert a value in a cell based upon a comparison of cell values in 2 separate worksheets | Excel Discussion (Misc queries) | |||
Insert a value in a cell based upon a comparison of cell values in 2 separate worksheets | Excel Worksheet Functions | |||
how do I insert a cell based on its match with an adjacent cell? | Excel Worksheet Functions |