Paste Special will work from kbd but not as a macro!!! Suggestions please!

  • Thread starter Thread starter John Baker
  • Start date Start date
J

John Baker

Hi:

I have a strange situation here. Simple spreadsheet, but I wanted to make some functions
automatic. Specifically, a cut and paste action.

I have the user select and copy data from another excel spreadsheet, and then want to
automate a paste values function, and a number of other steps after that. I have done a
"Macro record" of the process and it all works fine when done from the keyboard. BUT when
i run the macro the "paste values" fails. I tried just making it a Paste, and that wont
work either. The strange thing is that this works from the keyboard with no trouble at
all. Can someone suggest a way round this anomaly?

Thanks

John Baker
 
John

You're likely doing something in your code that clears the clipboard. Post
the code that you are using.
 
Hi:

Here is the macro. The user copies data from the other spreadsheet, and then clicks a
button to make the macro execute. The idea is to paste the data into the new spreadsheet
(MA3) and do some work on it.

What am I doing wrong?

Thanks

John Baker

Sub analysis1()
'

' Macro recorded 02/10/2004 by John H Baker
'

'
Sheets("MA3").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Copy

Columns("B:B").Select
Application.CutCopyMode = False
Selection.Cut
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
End Sub
 
Dick

Id be happy to...want to e mail me your address ([email protected]). Its something I
have not run into before, and I have done a fair amout of spreadsheet work.

Thanks for the offer. Could it be something to do with the data I am picking up?

Regards


John
 
John -

What error message is there?

Still using Excel 97 and running the code from a Controls Toolbox
command button on the sheet? Change the TakeFocusOnClick property of the
button to False.

- Jon
 
John

It worked as expected on my XL2000. Maybe Jon got it right if you're using
XL97.

Tell me what you expect to happen vs. what is actually happening.
 
Back
Top