View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Oldjay Oldjay is offline
external usenet poster
 
Posts: 337
Default Expanding a range

I have the following code

Private Sub CommandButton1_Click() 'Extend range and sort project numbers

Application.ScreenUpdating = False 'Keeps screen from updating thereby
speeding
Application.DisplayAlerts = False 'code execution

Dim Project_Numbers As Range

Application.GoTo Reference:="Project_Numbers" 'Check to see if the first
record is blank
Range("A11").Select
If Range("A12") = "" Then
Range("A12").Select
End
Else

Set rng = Range("Project_Numbers")
rng.Resize(rng.Rows.Count + 1).Name = "Project_Numbers"
Selection.Sort Key1:=Range("A11"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Application.GoTo Reference:="Employee_Initials"

MainMenu.Show
End If
End Sub

This works fine if I am only adding one project at a time. but some times I
might add 2 or more projects

thanks in advance

oldjay