PC Review


Reply
Thread Tools Rate Thread

Copy macro for a list box

 
 
=?Utf-8?B?RXJpYw==?=
Guest
Posts: n/a
 
      1st Oct 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      1st Oct 2007
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 With Quote
 
=?Utf-8?B?RXJpYw==?=
Guest
Posts: n/a
 
      1st Oct 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for copy to list Garrystone Microsoft Excel Misc 1 19th Jun 2008 12:39 PM
macro to copy a function down a list =?Utf-8?B?c3RldmVu?= Microsoft Excel Programming 2 13th Feb 2007 03:29 PM
Macro to copy active sheet and email to distribution list bsnapool Microsoft Excel Programming 1 11th Jul 2006 07:19 PM
Need macro to copy a list of named cells between worksheets =?Utf-8?B?Sm9obg==?= Microsoft Excel Worksheet Functions 3 8th Jan 2006 11:33 PM
Macro to copy filtered list to new workbook. cribology - ExcelForums.com Microsoft Excel Programming 3 3rd Aug 2005 10:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:25 AM.