![]() |
|
#2
|
||||
|
||||
|
So what, exactly, does the external-sheet reference to A20 look like? Like this?
Code:
='C:\path\[external.xlsx]Sheet1'!$A$20 In the character string "='C:\path\[external.xlsx]Sheet1'!$A$20", the row (20) starts in character position 37. Once you have that position in a variable—let's call it pr, ie the Position of the Row—you can modify the cell's Formula property like this: Code:
' Assume that co is the cell object we're pointing at. vf = co.Formula co.Formula = Left(vf, pr - 1) & Mid(vf, pr) + 2 Code:
pr = InStrRev(vf, "$") + 1 Code:
For pr = Len(vf) To 1 Step -1
If InStr("0123456789", Mid(vf, pr, 1)) = 0 Then Exit For
Next pr
pr = pr + 1
|
| Tags |
| cell references, macro, vba excel |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Creating a Macro to change the shading of a cell
|
Triscia | Word VBA | 3 | 01-30-2013 04:18 PM |
| Change formula cell range based on cell value | Scoth | Excel | 4 | 10-25-2012 07:51 AM |
| Formula that references cell with text in different workbook | no1texan | Excel | 3 | 07-17-2012 05:58 AM |
| Detect a cell has un-approved change or not? | LongTTH | Excel Programming | 1 | 05-20-2012 02:22 AM |
how to change number in cell
|
ubns | Excel | 5 | 05-14-2012 04:21 PM |