LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel VBA - Inserting associated values in a report Please Help :)

Here's my sample data:
Column A, Column E on Worksheet ("CO")
"555-555-5555","Jim"
"123-456-7890","Jim"
"987-654-3210","Jim"
"444-444-4444","Kandy"
"333-333-3333","Kandy"
"222-222-2222","Steve"

Hi all I could really use some help on this. I'm printing reports in
excel based on values in a worksheet. The report desired prints the
name of the person along with all phone #'s associated with that
person.. Therefore the first report would Generate a page that says
"Jim" and the 3 phone numbers above associated with him, and then the
second would say Kandy with her two numbers and the last Steve with
one.

I'm using VBA to do this because this is basically automating an
annoying process here at work. So far I can get the report to print
for each unique name, but I'm having an issue figuring how out to add
those related phone numbers to each report. Here's the code I'm using:

Private Sub CommandButton1_Click()
Dim main, telephone As Range, i, k As Integer

i = 0
k = 1

Set main = Sheet1.Range("E" & k)
Set telephone = Worksheets("CO").Range("A27:I33")

Worksheets("CO").Range("B9").Value = Sheet1.Range("E" & k).Text
'name of person

Do While main.Offset(i, 0) < ""
If Sheet1.Range("E" & k).Text <
Worksheets("CO").Range("B9").Value Then
Worksheets("CO").PrintOut
Worksheets("CO").Range("B9").Value = Sheet1.Range("E"
& k).Text 'update name
If Sheet1.Range("E" & k + 1).Text = "" Then
Worksheets("CO").PrintOut
End If
k = k + 1
i = i + 1
ClearCourtOrder
Loop

End Sub

That prints the reports fine but can anyone suggest how to add the
associated phone numbers onto the report as well? Ideally, I set up a
range called telephone from A27:I33 on "CO" and would like the numbers
listed in that range only. I really appreciate any insight on how to
approach this.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting rows slow on large report Robbro Excel Discussion (Misc queries) 6 March 9th 10 10:03 PM
Excel Pivot Table - Sort Report Filter Values Jeff Reese Excel Discussion (Misc queries) 3 September 13th 09 12:30 AM
Automate Excel report to place certain data into existing report? Craig Harrison Excel Worksheet Functions 3 July 25th 06 01:54 PM
can excel report scientific values rather than absolute numbers? JamesB Excel Discussion (Misc queries) 2 October 13th 05 03:00 PM
Fill an individual report with values from a team report? alymcmorland[_4_] Excel Programming 2 October 13th 05 09:39 AM


All times are GMT +1. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"