PDA

View Full Version : display records by office



jimmymoon
04-28-2010, 09:44 AM
I am a newbie in Excel/VBA.
would you please help me to figure out this project.
First, get the data from source.
Second, Display the data based on office in the certain office place in Result sheet.
see attached excel file. would you help me
the following is so far what I done;


Sub ExtractDept()
Dim i As Integer
Dim intCount As Integer
Dim strDept As String
Dim startpoint As String
Dim Msg As String
Dim rngCell As Range
Dim strYesNo As String
Application.DisplayAlerts = False
'reference the range;NQ,SR,GP,WR,CC,DC
strDept = Range(OFFICE)
'startarea=NQ,SR,GP,WR,CC,DC
startpoint = Range(startarea)
'In a certain office area, paste records according to Office In Result sheet

Sheets(strDept & "Sheet").Range("a1").Select
ActiveSheet.Paste

Do While Range("start").Offset(i, 1) <> ""
If Range("start").Offset(i, 1) = strDept Then
' go to startpoint place ; startarea=strDept
Range(Range("start").Offset(i, 0), Range("start").Offset(i, 4)).Copy
intCount = intCount + 1
sht.Range("a1").Offset(intCount, 0).Select
sht.Paste
End If
i = i + 1
Loop

Columns.AutoFit
ActiveWindow.DisplayGridlines = False


End Sub

lucas
04-28-2010, 12:53 PM
Thread moved to Excel Help forum