?
Solved

Worksheet Change Syntax Troubles

Posted on 2011-10-05
4
Medium Priority
?
183 Views
Last Modified: 2012-05-12
I am trying to manually call the Worksheet_Change Subroutine.  My code looks like this...


Private Sub mySubroutine()
…code…
Call Worksheet_Change (Temp)
…code…
End Sub

Open in new window


Temp is a named range.  The error I get is "Object Required".

I have also tried things like "$A$1:$A$1" and its variations.  Here I get a type mismatch error.

I do not need the target to point to anything, I just need the subroutine to run.

Ideas?


0
Comment
Question by:randys106
  • 3
4 Comments
 
LVL 26

Expert Comment

by:redmondb
ID: 36922437
randys106

Total cheat, but (assuming the sheet is "Sheet1"), what about replacing the Call line by...
Sheets("Sheet1").Cells(1, 1).Formula = Cells(1, 1).Formula

Open in new window

Regards,
Brian.
0
 
LVL 26

Accepted Solution

by:
redmondb earned 2000 total points
ID: 36922450
oops...
Sheets("Sheet1").Cells(1, 1).Formula = Sheets("Sheet1").Cells(1, 1).Formula

Open in new window

0
 

Author Closing Comment

by:randys106
ID: 36922486
Yes its a cheat...and a damn beautiful one.  I like it!  It worked perfectly.
0
 
LVL 26

Expert Comment

by:redmondb
ID: 36922492
Thanks, glad to help!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question