Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Copy macro for a list box

I am new to VBA and am trying to work with a Userform
On my user form I have listed all contract #'s and they are not in any
particular order. When I click on my userform I want to copy all the tests
for the contract I highlighted to another sheet (sheet 1). How is this done?

ie:
contract #
123
456
789
456
123

I want every test for contract # 456 copied to sheet 1 starting on cell A2.
Can anyone help me??? Please.

Eric
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Copy macro for a list box

Prvate Sub CommandButton1_Click()
for i = 0 to Userform1.Listbox1.listcount - 1
if Userform1.Listbox1.Selected(i) then
' call Ron's macro altered to work with your data
end if
Next
End Sub

Autofilter
http://www.rondebruin.nl/copy5.htm

--
Regards,
Tom Ogilvy

"Eric" wrote:

I am new to VBA and am trying to work with a Userform
On my user form I have listed all contract #'s and they are not in any
particular order. When I click on my userform I want to copy all the tests
for the contract I highlighted to another sheet (sheet 1). How is this done?

ie:
contract #
123
456
789
456
123

I want every test for contract # 456 copied to sheet 1 starting on cell A2.
Can anyone help me??? Please.

Eric

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default Copy macro for a list box

Tom,

The "Create a new sheet for all unique values" macro works well but I don't
want to have a new sheet for every contract Number as a matter of fact I
don't want the sheet to even change names. I just want to copy all the
identical contract numbers to a separate sheet so that I can graph the
results. Each time I transphere the information I want them to end up back
on the second sheet no matter what the number is. I hope I explained what I
am looking for. If I haven't I will try again. Please be patient with me.
Thank you

Eric

"Tom Ogilvy" wrote:

Prvate Sub CommandButton1_Click()
for i = 0 to Userform1.Listbox1.listcount - 1
if Userform1.Listbox1.Selected(i) then
' call Ron's macro altered to work with your data
end if
Next
End Sub

Autofilter
http://www.rondebruin.nl/copy5.htm

--
Regards,
Tom Ogilvy

"Eric" wrote:

I am new to VBA and am trying to work with a Userform
On my user form I have listed all contract #'s and they are not in any
particular order. When I click on my userform I want to copy all the tests
for the contract I highlighted to another sheet (sheet 1). How is this done?

ie:
contract #
123
456
789
456
123

I want every test for contract # 456 copied to sheet 1 starting on cell A2.
Can anyone help me??? Please.

Eric

Reply
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
Macro for copy to list Garrystone Excel Discussion (Misc queries) 1 June 19th 08 12:39 PM
macro to copy a function down a list Tom Ogilvy Excel Programming 0 February 13th 07 03:29 PM
macro to copy a function down a list Don Guillett Excel Programming 0 February 13th 07 03:22 PM
Need macro to copy a list of named cells between worksheets John Excel Worksheet Functions 3 January 8th 06 11:33 PM
Macro to copy filtered list to new workbook. cribology - ExcelForums.com Excel Programming 3 August 3rd 05 10:08 AM


All times are GMT +1. The time now is 05:12 PM.

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

About Us

"It's about Microsoft Excel"