Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Worksheet change

This is fairly straightforward -

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 1 Then
Sheets("Sheet1").Select
Range("D1").Select
End If
End Sub

but for the range select I get Runtime Error 1004 -- Select Method of Range
Class Failed. I don't necessarily even want to go to Sheet1, but I get the
same problem with eg:
If Target.Column = 1 Then
Range("Sheet1!D1").Value = Range("B2").Value

I've seen replies to other questions on Worksheet_Change where switching to
other sheets is OK, so I'm assuming it's something to do with my
installation. Any suggestions gratefully received.

TIA,
Andy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Worksheet change

try
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 1 Then Exit Sub
Application.Goto reference:=[Sheet1!d1]
End Sub

"Andy Brown" wrote in message
...
This is fairly straightforward -

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 1 Then
Sheets("Sheet1").Select
Range("D1").Select
End If
End Sub

but for the range select I get Runtime Error 1004 -- Select Method of

Range
Class Failed. I don't necessarily even want to go to Sheet1, but I get the
same problem with eg:
If Target.Column = 1 Then
Range("Sheet1!D1").Value = Range("B2").Value

I've seen replies to other questions on Worksheet_Change where switching

to
other sheets is OK, so I'm assuming it's something to do with my
installation. Any suggestions gratefully received.

TIA,
Andy




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Worksheet change

It is just 3 times slower - but does avoid the reference problem.

Regards,
Tom Ogilvy

Don Guillett wrote in message
...
I didn't suggest you use application with this. Only if using the goto
reference.
[Sheet1!D65536].End(xlUp).Offset(1, 0).Value = [B2]
should work as well.

"Andy Brown" wrote in message
...
Gents, I simplified the question in the interests of focussing on the

main
problem. I was actually after shunting Sheet2!B1 to the first free cell

in
Sheet1!D:D (with D1 as a label). Therefore,

(Don),
Application.[Sheet1!D65536].End(xlUp).Offset(1, 0).Value =

Range("B2").Value
worked fine ;

(Mr Ogilvy),
Sheets("Sheet1").Range("D65536").End(xlUp).Offset( 1, 0).Value =
Range("B2").Value
worked fine, and the error explanation was excellent.

Thanks much to you both,
Andy






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Worksheet change

Tom,
I have a fast computer.<G

"Tom Ogilvy" wrote in message
...
It is just 3 times slower - but does avoid the reference problem.

Regards,
Tom Ogilvy

Don Guillett wrote in message
...
I didn't suggest you use application with this. Only if using the goto
reference.
[Sheet1!D65536].End(xlUp).Offset(1, 0).Value = [B2]
should work as well.

"Andy Brown" wrote in message
...
Gents, I simplified the question in the interests of focussing on the

main
problem. I was actually after shunting Sheet2!B1 to the first free

cell
in
Sheet1!D:D (with D1 as a label). Therefore,

(Don),
Application.[Sheet1!D65536].End(xlUp).Offset(1, 0).Value =

Range("B2").Value
worked fine ;

(Mr Ogilvy),
Sheets("Sheet1").Range("D65536").End(xlUp).Offset( 1, 0).Value =
Range("B2").Value
worked fine, and the error explanation was excellent.

Thanks much to you both,
Andy








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
how to change the pivot chart automaticaly as values in the worksheet change Vinay Vasu Excel Worksheet Functions 0 May 3rd 10 04:25 PM
VBA Worksheet change name James C[_2_] Excel Discussion (Misc queries) 2 January 26th 10 05:34 PM
change formula in a shared worksheet without losing change history DCE Excel Worksheet Functions 5 July 25th 08 01:37 PM
Help Please, Worksheet Change ilvmgicker Excel Worksheet Functions 1 June 14th 06 09:41 AM
Worksheet Change event DoctorG Excel Discussion (Misc queries) 4 February 15th 06 12:53 PM


All times are GMT +1. The time now is 11:37 AM.

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"