View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Selecting the Current Column ?

The current column is the column containing the ActiveCell:

ActiveCell.EntireColumn.Select
--
Gary''s Student - gsnu200806


"Michael Hudston" wrote:

How do I select the current Column in VBA, so I can then insert a whole new
one to the left of it?

Ive got most of the code down, but I cant select a single column for some
reason.

Help Please

Private Sub Update_LRU_List_Click()

Dim EBS_LRU_Count As Double
Dim Trend_LRU_Count As Double
Dim LRU_Diff As Double

EBS_LRU_Count = Sheets("BASIC CHART DATA").Range("D6")
Trend_LRU_Count = Sheets("BASIC CHART DATA").Range("D7")
LRU_Diff = EBS_LRU_Count - Trend_LRU_Count

Application.Goto Reference:=Worksheets("Trend
Analysis").Range("I5").Offset(0, Trend_LRU_Count), Scroll:=False

If LRU_Diff 0 Then
For Xnum = 1 To LRU_Diff

'Locates Current Column, depent on Number of Missing LRU's
Application.Goto Reference:=Worksheets("Trend
Analysis").Range("I5").Offset(0, Xnum + 1), Scroll:=False

'Select Current Column
'INSERT LINE HERE TO SELECT THE WHOLE OF THE CURRENT COLUMN

'Insert a new Column immedaitely to the right of the Current
Column
Selection.Insert Shift:=xlToRight,
CopyOrigin:=xlFormatFromLeftOrAbove

' Populate heading of New Column from LRU List

Next
End If
End Sub