View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
new2Texas new2Texas is offline
external usenet poster
 
Posts: 1
Default Inserting an entire column causes sub to stop

I used the
Selection.EntireColumn.Insert
command at the point where i wanted the column inserted , it inserted
the column and won't process any more steps. Please Help. After
inserting the column, the code just stops and won't go any further
WITHOUT AN ERROR MESSAGE. Please Help

Code follows

Sub addcolumn()

Dim n As Integer
Dim Codecols As Integer
Dim Addcol As Boolean
Dim Delcol As Boolean
Application.Goto Reference:="colOffSet"
n = ActiveCell
Codecols = n + 5
Application.Goto Reference:="addcol"
Addcol = ActiveCell
Application.Goto Reference:="delcol"
Delcol = ActiveCell
Sheets("Ledger").Select
ActiveSheet.Unprotect
'
If Addcol = True Then
Sheets("Ledger").Select
Application.Goto Reference:="R1C" & Codecols
ActiveCell.Activate
Selection.EntireColumn.Insert
Range("B52").Select
Else
If Delcol = True Then
Sheets("Ledger").Select
Application.Goto Reference:="R1C" & Codecols
Selection.EntireColumn.Delete
End If
End If
RefreshRank
End Sub