Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook with multiple tables in different tabs. One of the tabs has
the "Master Table", that has the names of the sales people in the first column and then their data in the rest of the columns. All tables in the other tabs have sales people in the first columns, and then different types of data, depending on the tab. I need to write a macro, so that when a new sales person raw inserted into teh "Master Table", the tables in the other tabs would also update themselves with the new sales person's name. The challenge is that I need the raws to be sorted alphabetically. I managed to write a macro to insert and sort it in teh "Master Table", but then don't know how to proceed with the other tables ? Here is what I 've got so far: Sub GetData() Dim NextRow As Long Dim NameEntry As String, SiteIDEntry As String, StartDateEntry As String, _ EndDateEntry As String, RenewalEntry As String Do 'determine next empty row NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 MsgBox ("Next Empty Row is row " & NextRow) 'Prompt the data NameEntry = StrConv(InputBox("Enter the VAR Name or Cancel to Exit"), vbUpperCase) If NameEntry = "" Then Exit Sub SiteIDEntry = StrConv(InputBox("Enter the VAR Site ID"), vbUpperCase) If SiteIDEntry = "" Then Exit Sub StartDateEntry = InputBox("Enter the Start Date as MM/DD/YYYY") If StartDateEntry = "" Then Exit Sub EndDateEntry = InputBox("Enter the End Date as MM/DD/YYYY") If EndDateEntry = "" Then Exit Sub RenewalEntry = InputBox("Is this a contract renewal?") If RenewalEntry = "" Then Exit Sub 'write the data Cells(NextRow, 1) = NameEntry MsgBox ("Wrote NameEntry") Cells(NextRow, 2) = SiteIDEntry MsgBox ("Wrote SiteIDEntry") Cells(NextRow, 3) = StartDateEntry Selection.NumberFormat = "mm/dd/yyyy" MsgBox ("Wrote and Formatted the StartDateEntry") Cells(NextRow, 4) = EndDateEntry Selection.NumberFormat = "mm/dd/yyyy" MsgBox ("Wrote and Formatted the EndDateEntry") Cells(NextRow, 5) = RenewalEntry MsgBox ("Wrote the RenewalEntry") 'sort alphabetically Range("A1").Select Range("A1").CurrentRegion.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Loop ' here would go the procedure to update table in tab1 'here would go the procedure to update table in tab2 End sub Thanks for your help! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple Pivot Tables based on the same data | Excel Discussion (Misc queries) | |||
PivotTable based on multiple ranges or tables | Excel Discussion (Misc queries) | |||
Pivot Tables with different groupings based on same data table | Excel Discussion (Misc queries) | |||
Pivot Tables with different groupings based on same data table | New Users to Excel | |||
need help please inserting multiple rows based on cell value then copying to data sheet | Excel Worksheet Functions |