ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert colmn (https://www.excelbanter.com/excel-programming/419242-insert-colmn.html)

Yossy

Insert colmn
 
how can I automatically insert column before "Column name Top" across
multiple sheet. Also date each column for current month E.g) 1 - Sep -08

all help totally appreciated. thanks

Sheeloo[_3_]

Insert colmn
 
Do you want to insert a column before the Column containing "Top" in Row 1,
on ALL sheets and enter 1-Oct-08 in Row 1 for the new column, Oct-08 being
the current month?

"Yossy" wrote:

how can I automatically insert column before "Column name Top" across
multiple sheet. Also date each column for current month E.g) 1 - Sep -08

all help totally appreciated. thanks


Sheeloo[_3_]

Insert colmn
 
Try
Sub insertCol()
Dim dt As String
dt = Application.WorksheetFunction.Text(Date, "dd-mmm-yyyy")
dt = "01" & Right(dt, Len(dt) - 2)
For Each ws In Worksheets
ws.Activate
Range("1:1").Select
For Each c In Selection
If c.Value = "Top" Then
c.Select
Selection.EntireColumn.Insert
ActiveCell.Value = dt
Exit For
End If
Next
Next
End Sub

"Sheeloo" wrote:

Do you want to insert a column before the Column containing "Top" in Row 1,
on ALL sheets and enter 1-Oct-08 in Row 1 for the new column, Oct-08 being
the current month?

"Yossy" wrote:

how can I automatically insert column before "Column name Top" across
multiple sheet. Also date each column for current month E.g) 1 - Sep -08

all help totally appreciated. thanks



All times are GMT +1. The time now is 09:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com