Hello all. I am an architect and I am trying to develop a code in excel for organizing our projects.
So far I have a workbook with two tabs. Sheet1 is called "Entry" and Sheet2 is called "NumericalOrder". The headers on the Entry and Numerical Order sheets is Project #, Project Name, Project Industry, Project Type, and Tracking Sheet across row 1.
I am using a command button so our office manager will enter in the needed information on the Entry sheet under the necessary headers. The command button moves all the information into the NumericalOrder sheet under the correct headers and also clears the info in the Entry sheet. This part I have figured out.
Now what I want done, is when the data is transferred to NumericalOrder, the data populates in the list by numerical order in column A "Project #". I don't want to have our office manager click sort every time she had information put in the NumericalOrder worksheet.
Basically add this function to my command button so two functions happen with one click.
What do I need to add to my code to get this sorting issue out of my way? I have been watching tutorials on coding for the past two days without having any prior knowledge and I can't find any information to answer my current question!! I hope you all can help
Here is my current working VBA Command Button code:
<code>Private Sub CommandButton1_Click()
Dim ProjectNumber As String, ProjectName As String, ProjectIndustry As String, ProjectType As String, TrackingSheet As String
Worksheets("Entry").Select
ProjectNumber = Range("A2")
ProjectName = Range("B2")
ProjectIndustry = Range("C2")
ProjectType = Range("D2")
TrackingSheet = Range("E2")
Worksheets("NumericalOrder").Select
Worksheets("NumericalOrder").Range("A1").Select
If Worksheets("NumericalOrder").Range("A1").Offset(1, 0) <> "" Then
Worksheets("NumericalOrder").Range("A1").End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = ProjectNumber
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectName
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectIndustry
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectType
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TrackingSheet
Worksheets("Entry").Select
Worksheets("Entry").Range("A2:E2").ClearContents
End Sub</code>
So far I have a workbook with two tabs. Sheet1 is called "Entry" and Sheet2 is called "NumericalOrder". The headers on the Entry and Numerical Order sheets is Project #, Project Name, Project Industry, Project Type, and Tracking Sheet across row 1.
I am using a command button so our office manager will enter in the needed information on the Entry sheet under the necessary headers. The command button moves all the information into the NumericalOrder sheet under the correct headers and also clears the info in the Entry sheet. This part I have figured out.
Now what I want done, is when the data is transferred to NumericalOrder, the data populates in the list by numerical order in column A "Project #". I don't want to have our office manager click sort every time she had information put in the NumericalOrder worksheet.
Basically add this function to my command button so two functions happen with one click.
What do I need to add to my code to get this sorting issue out of my way? I have been watching tutorials on coding for the past two days without having any prior knowledge and I can't find any information to answer my current question!! I hope you all can help
Here is my current working VBA Command Button code:
<code>Private Sub CommandButton1_Click()
Dim ProjectNumber As String, ProjectName As String, ProjectIndustry As String, ProjectType As String, TrackingSheet As String
Worksheets("Entry").Select
ProjectNumber = Range("A2")
ProjectName = Range("B2")
ProjectIndustry = Range("C2")
ProjectType = Range("D2")
TrackingSheet = Range("E2")
Worksheets("NumericalOrder").Select
Worksheets("NumericalOrder").Range("A1").Select
If Worksheets("NumericalOrder").Range("A1").Offset(1, 0) <> "" Then
Worksheets("NumericalOrder").Range("A1").End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = ProjectNumber
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectName
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectIndustry
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectType
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TrackingSheet
Worksheets("Entry").Select
Worksheets("Entry").Range("A2:E2").ClearContents
End Sub</code>