View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Excel_VBA_Newb Excel_VBA_Newb is offline
external usenet poster
 
Posts: 13
Default use a variable to set a range

How do I perform this:

'Obtain last column that contains data
lastCol = ActiveSheet.UsedRange.Column - 1 +
ActiveSheet.UsedRange.Columns.Count

'Convert to Alpha
(code omitted for brievity)

'Define the Column in the range based on the previous check
Range(lastCol:lastCol).Insert Shift:=xlToLeft

Thanks.