Hi Azhar,

 

Try this revised with some changes hope it helps you:

 

Sub InsertColumnWithFormula()

    Const lngNoOfCol                As Long = 2

    Dim varSheets()                 As Variant

    Dim lngLoop                     As Long

    Const strStartRange             As String = "D1"

    

    

    varSheets = Array("Sheet1", "Sheet2", "Sheet3")

    

    Application.DisplayAlerts = False

    Application.Calculation = xlCalculationManual

    Application.EnableEvents = False

    

    For lngLoop = LBound(varSheets) To UBound(varSheets)

        With ThisWorkbook.Worksheets(varSheets(lngLoop))

            If lngLoop = LBound(varSheets) Then

                .Range(strStartRange).Offset(, (lngNoOfCol - 1) *
-1).Resize(, lngNoOfCol).EntireColumn.Copy

            End If

            .Range(strStartRange).Offset(, 1).Insert Shift:=xlToRight

        End With

    Next lngLoop

    

    Application.CutCopyMode = xlCopy

    Application.EnableEvents = True

    Application.Calculation = xlCalculationAutomatic

    Application.DisplayAlerts = True

End Sub

 

 

Regards,

Lalit Mohan

www.excelfox.com/forum

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Rajan_Verma
Sent: Saturday, June 30, 2012 10:29 AM
To: excel-macros@googlegroups.com
Subject: RE: $$Excel-Macros$$ Re: IN TROUBLE

 

Just Group your all worksheet by selecting them with Ctrl key and work with
any one ,

 

 

Regards

Rajan verma

+91 7838100659 [IM-Gtalk]

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Lalit_Mohan
Sent: 29 June 2012 5:03
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Re: IN TROUBLE

 

Hi Azhar,

 

Try this and change accordingly

 

Sub InsertColumnWithFormula()

    Const lngNoOfCol                As Long = 2
    Dim varSheets()                 As Variant
    Dim lngLoop                     As Long
    Const strStartRange             As String = "R1"
    
    
    varSheets = Array("Sheet1", "Sheet2", "Sheet3")
    
    Application.DisplayAlerts = False
    Application.Calculation = xlCalculationManual
    Application.EnableEvents = False
    
    For lngLoop = LBound(varSheets) To UBound(varSheets)
        With ThisWorkbook.Worksheets(varSheets(lngLoop))
                .Range(strStartRange).Offset(, (lngNoOfCol - 1) *
-1).Resize(, lngNoOfCol).EntireColumn.Copy
                .Range(strStartRange).Offset(, 1).Insert Shift:=xlToRight
        End With
    Next lngLoop
    
    Application.CutCopyMode = xlCopy
    Application.EnableEvents = True
    Application.Calculation = xlCalculationAutomatic
    Application.DisplayAlerts = True

End Sub

 

Regards,

Lalit Mohan

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security
measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
 
----------------------------------------------------------------------------
--------------------------
To post to this group, send email to excel-macros@googlegroups.com
 
To unsubscribe, send a blank email to
excel-macros+unsubscr...@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security
measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
 
----------------------------------------------------------------------------
--------------------------
To post to this group, send email to excel-macros@googlegroups.com
 
To unsubscribe, send a blank email to
excel-macros+unsubscr...@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com

Reply via email to