Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default changing a cell reference


Hi everyone. I am hoping someone is willing to help. I would like to
to test if a cell containing, a cell reference (eg, f(x) = Sheet2!A1),
grabs a value from a particular sheet (in this case Sheet2). If this
is the case, I want to change the sheet which it pulls a value from
(say Sheet1). My question is how do I (a) test this condition and (b)
edit the formula so it references a different sheet?

Here is my code thus far:

Sub ChangeRef()
Dim ws As Worksheet
Dim ReplaceWith As String
Dim ref As String

ref = Left("=#REF", 5)
ReplaceWith = "=Autofilter"

For Each ws In ActiveWorkbook.Worksheets
ws.Activate
For Each cell In ActiveSheet.UsedRange.Cells
'' If cell formula contains #REF! Then replace with
Autofilter!
cell = WorksheetFunction.Replace(ref, 1, 10, ReplaceWith)
'' End If
Next cell
Next ws
End Sub

Thank you to anyone that can help me.

-- Isaac M


--
I Maycotte
------------------------------------------------------------------------
I Maycotte's Profile: http://www.excelforum.com/member.php...o&userid=35604
View this thread: http://www.excelforum.com/showthread...hreadid=553767

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
Changing relative cell reference richzip Excel Discussion (Misc queries) 2 May 22nd 10 12:06 PM
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
changing a cell reference I Maycotte[_2_] Excel Programming 0 June 20th 06 07:31 PM
How to change reference to other worksheet by changing one cell? Ms.Vahl Excel Worksheet Functions 2 November 10th 05 06:56 AM
A cell reference in a formula changing knemitz Excel Worksheet Functions 1 February 28th 05 06:10 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"