PC Review


Reply
Thread Tools Rate Thread

Code Not Working with Click Box

 
 
=?Utf-8?B?TXIuIE1hdHQ=?=
Guest
Posts: n/a
 
      12th Oct 2007
Hello,
The code below works perfectly well until I assign it to a click button.

Working Code:
Sub TransposeValues()
Sheets("VAV List").Select
Range("A2:A3").Select
Selection.Copy
Sheets("Sheet1").Select
Range("C3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True
End Sub

Once assigned to a click button, I get an error saying "Select Method of
Range Class Failed" with Range("C3").Select highlighted as the culprit.

Not Working Code:
Private Sub CommandButton1_Click()
Sheets("VAV List").Select
Range("A2:A3").Select
Selection.Copy
Sheets("Sheet1").Select
Range("C3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks:=False, Transpose:=True
End Sub

Please help
Thanks
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      12th Oct 2007
This worked for me:

Sub TransposeValues()
Sheets("VAV List").Range("A2:A3").Copy
Sheets("Sheet1").Range("C3").PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End Sub


"Mr. Matt" wrote:

> Hello,
> The code below works perfectly well until I assign it to a click button.
>
> Working Code:
> Sub TransposeValues()
> Sheets("VAV List").Select
> Range("A2:A3").Select
> Selection.Copy
> Sheets("Sheet1").Select
> Range("C3").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks:=False, Transpose:=True
> End Sub
>
> Once assigned to a click button, I get an error saying "Select Method of
> Range Class Failed" with Range("C3").Select highlighted as the culprit.
>
> Not Working Code:
> Private Sub CommandButton1_Click()
> Sheets("VAV List").Select
> Range("A2:A3").Select
> Selection.Copy
> Sheets("Sheet1").Select
> Range("C3").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> SkipBlanks:=False, Transpose:=True
> End Sub
>
> Please help
> Thanks

 
Reply With Quote
 
=?Utf-8?B?TXIuIE1hdHQ=?=
Guest
Posts: n/a
 
      13th Oct 2007
Did it work when assigned to a click box?

"JLGWhiz" wrote:

> This worked for me:
>
> Sub TransposeValues()
> Sheets("VAV List").Range("A2:A3").Copy
> Sheets("Sheet1").Range("C3").PasteSpecial Paste:=xlPasteValues, _
> Operation:=xlNone, SkipBlanks:=False, Transpose:=True
> End Sub
>
>
> "Mr. Matt" wrote:
>
> > Hello,
> > The code below works perfectly well until I assign it to a click button.
> >
> > Working Code:
> > Sub TransposeValues()
> > Sheets("VAV List").Select
> > Range("A2:A3").Select
> > Selection.Copy
> > Sheets("Sheet1").Select
> > Range("C3").Select
> > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> > SkipBlanks:=False, Transpose:=True
> > End Sub
> >
> > Once assigned to a click button, I get an error saying "Select Method of
> > Range Class Failed" with Range("C3").Select highlighted as the culprit.
> >
> > Not Working Code:
> > Private Sub CommandButton1_Click()
> > Sheets("VAV List").Select
> > Range("A2:A3").Select
> > Selection.Copy
> > Sheets("Sheet1").Select
> > Range("C3").Select
> > Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
> > SkipBlanks:=False, Transpose:=True
> > End Sub
> >
> > Please help
> > Thanks

 
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
Re: Right click stops working/New tabs stop working/Menu bar disappear Robert Aldwinckle Windows Vista Performance 8 20th Nov 2007 09:03 PM
Why Isn't My Mouse Click Code Working =?Utf-8?B?SmVycnk=?= Microsoft Dot NET 3 21st May 2007 12:05 AM
Code to simulate mouse click not working - code sample attached John Michl Microsoft Powerpoint 3 19th Oct 2005 03:00 PM
ASP.NET client-side validation working, but button click not working Alan Silver Microsoft ASP .NET 1 2nd Aug 2005 04:50 PM
Single click stops double-click working?? Help?? Siv Microsoft VB .NET 3 11th Jul 2005 02:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:16 AM.