Thread: copy and paste
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default copy and paste

Same as before, your Q my A.

1) I get the listbox and can pick a mix type then I recieve an error
"Autofilter Method or Range class failed".

That autofilter in my nemesis. I couldn't get it to work in the click event
so I moved it to the standard module and it worked. Now you are getting the
error in the standard module. Are you sure you put the code in Module1 of
the VB editor? It will not work properly anywhere else. If you did, then
copy the code and paste it back into this posting so I can see if I left
something in that I used to run on my system.


2) In this list box can we do the no dupes so that I don't have a mix type
for each test. I only want to see the different mix types not all of them.

I think that if the autofilter works, it will do the same thing. If you look
at your no dupes code and then look at the first half of the new last4 code
it should be about the same. Let me know if I am wrong.


3) I will need to delete cells ("B72:AD700") on sheets("last four") after
it posts up on to rows 9 through 12 on sheets("last four"). I figure I can
tack this on to the Last4 macro, is this correct?

Yes, Add this line just before the "End Sub" in the last4 code:

Sheets("last four").Range("B72:AD" & lr4).ClearContents

The variable lr4 allows for any changes in the size of the data range. It
finds the last row that was copied over no matter how many.


4) At the end of your last posting you place New subject. Clearing content
from Range("A9:AD12").clearcontents. Did you think I wanted to clear this?
I do not want this cleared until the next time I need to run this macro.

Read the instructions carefully. It says to change the code that is now in
there from Range("A9:Z12").ClearContents. The location of this command in
the code is before the data is copied over from test Database, which means
that it is clearing data from the previous posting not the current one.

In the mean time here is something for you to play with. You might have
done this before, but just in case, follow these steps to see what the
code does.

1. Open the VB editor. Alt + F11 Or ToolsMacroVisual Basic Editor
2. In the Project window on the top left of the screen, double click
on module1, if you are not already in that screen.
3. In the upper right of the screen is a panel that says Declarations.
Click in this panel and find "startLast4". Click on it.
4. You should now see that code segment in the big window and the
cursor should be blinking there. Click on the name one time just
in case.
5. Now you can use the F8 key to move one step at a time through the
entire process and see how the code works. A yellow highlight
will show you which step is executing as you move through.
6. If you are not in full screen with the VBE window, you can move
that window over so you can watch the Excel sheets as you
execute the code. Don't be surprised when the VBE screen
disappears while the UserForm is showing. When you click the
list box the VBE screen returns.
7. This is how you can debug your code. You can see exactly which
step causes the error.

Have fun.

"Eric" wrote:

JLGWhiz, I have copied everything this is how it looks....

Macro 1
Start last4() next
last4

Userform6
Userform_Initialize() Next
Listbox1_click()

1) I get the listbox and can pick a mix type then I recieve an error
"Autofilter Method or Range class failed".

2) In this list box can we do the no dupes so that I don't have a mix type
for each test. I only want to see the different mix types not all of them.

3) I will need to delete cells ("B72:AD700") on sheets("last four") after
it posts up on to rows 9 through 12 on sheets("last four"). I figure I can
tack this on to the Last4 macro, is this correct?

4) At the end of your last posting you place New subject. Clearing content
from Range("A9:AD12").clearcontents. Did you think I wanted to clear this?
I do not want this cleared until the next time I need to run this macro.

Eric