PC Review


Reply
Thread Tools Rate Thread

How to convert all 3d references to normal references in a workboo

 
 
Dima
Guest
Posts: n/a
 
      7th Aug 2008
Hello!
How to convert all 3d references to normal references in a workbook?
I want to move the ranges to which the 3d references refer, but the 3d
references do not follow the movement of the precedents inside the 3d range
and become corrupted.
Regards,
Dmitry
 
Reply With Quote
 
 
 
 
Jim Rech
Guest
Posts: n/a
 
      7th Aug 2008
If you mean that you'd like a way to convert this:

=SUM(Sheet2:Sheet4!A1)

to

=SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)

I don't think there is anything in Excel that does it unfortunately.

--
Jim
"Dima" <(E-Mail Removed)> wrote in message
news:F153F82D-E9CF-4C84-A496-(E-Mail Removed)...
| Hello!
| How to convert all 3d references to normal references in a workbook?
| I want to move the ranges to which the 3d references refer, but the 3d
| references do not follow the movement of the precedents inside the 3d
range
| and become corrupted.
| Regards,
| Dmitry


 
Reply With Quote
 
Dima
Guest
Posts: n/a
 
      7th Aug 2008
Thanks Jim for replying!
Yes, I mean the way to convert this:
=SUM(Sheet2:Sheet4!A1)
to
=SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
Dmitry
"Jim Rech" wrote:

> If you mean that you'd like a way to convert this:
>
> =SUM(Sheet2:Sheet4!A1)
>
> to
>
> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
>
> I don't think there is anything in Excel that does it unfortunately.
>
> --
> Jim
> "Dima" <(E-Mail Removed)> wrote in message
> news:F153F82D-E9CF-4C84-A496-(E-Mail Removed)...
> | Hello!
> | How to convert all 3d references to normal references in a workbook?
> | I want to move the ranges to which the 3d references refer, but the 3d
> | references do not follow the movement of the precedents inside the 3d
> range
> | and become corrupted.
> | Regards,
> | Dmitry
>
>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Aug 2008
Give this macro a try; place it in a Module (Insert/Module from the VBA menu
bar)...

Sub Expand3dFormula()
Dim RE As Object
Dim C As Range
Dim WS As Worksheet
Dim X As Long
Dim Y As Long
Dim StartIndex As Long
Dim EndIndex As Long
Dim ShtRef As String
Dim ShtStart As String
Dim ShtEnd As String
Dim CelRef As String
Dim WSname As String
Dim Reference As String
Dim REsub As String
Dim Parts() As String
For Each C In Selection
Set RE = CreateObject("VBScript.RegExp")
RE.Global = True
RE.Pattern = "[^:!a-zA-Z0-9=_]"
REsub = RE.Replace(C.Formula & "=", " ")
RE.Pattern = " "
REsub = Trim(RE.Replace(REsub, " "))
Set RE = Nothing
Parts = Split(REsub)
For X = 1 To UBound(Parts) - 1
Reference = ""
If Parts(X) Like "*:*!*" Then
ShtRef = Left(Parts(X), InStr(Parts(X), "!") - 1)
CelRef = Mid(Parts(X), InStr(Parts(X), "!") + 1)
ShtStart = Left(ShtRef, InStr(ShtRef, ":") - 1)
ShtEnd = Mid(ShtRef, InStr(ShtRef, ":") + 1)
For Each WS In Worksheets
If WS.Name = ShtStart Then StartIndex = WS.Index
If WS.Name = ShtEnd Then EndIndex = WS.Index
Next
For Y = StartIndex To EndIndex
WSname = Worksheets(Y).Name
If WSname Like "*[!a-zA-Z_]*" Then WSname = "'" & WSname & "'"
Reference = Reference & WSname & "!" & CelRef
If Y < EndIndex Then Reference = Reference & ","
Next
C.Formula = Replace(C.Formula, Parts(X), Reference)
End If
Next
Next
End Sub

Rick



"Dima" <(E-Mail Removed)> wrote in message
news:45FCFF38-0949-47A7-9D15-(E-Mail Removed)...
> Thanks Jim for replying!
> Yes, I mean the way to convert this:
> =SUM(Sheet2:Sheet4!A1)
> to
> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
> Dmitry
> "Jim Rech" wrote:
>
>> If you mean that you'd like a way to convert this:
>>
>> =SUM(Sheet2:Sheet4!A1)
>>
>> to
>>
>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
>>
>> I don't think there is anything in Excel that does it unfortunately.
>>
>> --
>> Jim
>> "Dima" <(E-Mail Removed)> wrote in message
>> news:F153F82D-E9CF-4C84-A496-(E-Mail Removed)...
>> | Hello!
>> | How to convert all 3d references to normal references in a workbook?
>> | I want to move the ranges to which the 3d references refer, but the 3d
>> | references do not follow the movement of the precedents inside the 3d
>> range
>> | and become corrupted.
>> | Regards,
>> | Dmitry
>>
>>
>>


 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Aug 2008
I should have mentioned, you need to select one or more cells (the macro can
handle contiguous as well as non-contiguous ranges of cells) and then run
the macro; it will then expand every 3D reference (even differing multiple
3D references within a single cell's formula) in every cell within the
selection.

Rick


"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
message news:%23xDe5GN%(E-Mail Removed)...
> Give this macro a try; place it in a Module (Insert/Module from the VBA
> menu bar)...
>
> Sub Expand3dFormula()
> Dim RE As Object
> Dim C As Range
> Dim WS As Worksheet
> Dim X As Long
> Dim Y As Long
> Dim StartIndex As Long
> Dim EndIndex As Long
> Dim ShtRef As String
> Dim ShtStart As String
> Dim ShtEnd As String
> Dim CelRef As String
> Dim WSname As String
> Dim Reference As String
> Dim REsub As String
> Dim Parts() As String
> For Each C In Selection
> Set RE = CreateObject("VBScript.RegExp")
> RE.Global = True
> RE.Pattern = "[^:!a-zA-Z0-9=_]"
> REsub = RE.Replace(C.Formula & "=", " ")
> RE.Pattern = " "
> REsub = Trim(RE.Replace(REsub, " "))
> Set RE = Nothing
> Parts = Split(REsub)
> For X = 1 To UBound(Parts) - 1
> Reference = ""
> If Parts(X) Like "*:*!*" Then
> ShtRef = Left(Parts(X), InStr(Parts(X), "!") - 1)
> CelRef = Mid(Parts(X), InStr(Parts(X), "!") + 1)
> ShtStart = Left(ShtRef, InStr(ShtRef, ":") - 1)
> ShtEnd = Mid(ShtRef, InStr(ShtRef, ":") + 1)
> For Each WS In Worksheets
> If WS.Name = ShtStart Then StartIndex = WS.Index
> If WS.Name = ShtEnd Then EndIndex = WS.Index
> Next
> For Y = StartIndex To EndIndex
> WSname = Worksheets(Y).Name
> If WSname Like "*[!a-zA-Z_]*" Then WSname = "'" & WSname & "'"
> Reference = Reference & WSname & "!" & CelRef
> If Y < EndIndex Then Reference = Reference & ","
> Next
> C.Formula = Replace(C.Formula, Parts(X), Reference)
> End If
> Next
> Next
> End Sub
>
> Rick
>
>
>
> "Dima" <(E-Mail Removed)> wrote in message
> news:45FCFF38-0949-47A7-9D15-(E-Mail Removed)...
>> Thanks Jim for replying!
>> Yes, I mean the way to convert this:
>> =SUM(Sheet2:Sheet4!A1)
>> to
>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
>> Dmitry
>> "Jim Rech" wrote:
>>
>>> If you mean that you'd like a way to convert this:
>>>
>>> =SUM(Sheet2:Sheet4!A1)
>>>
>>> to
>>>
>>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
>>>
>>> I don't think there is anything in Excel that does it unfortunately.
>>>
>>> --
>>> Jim
>>> "Dima" <(E-Mail Removed)> wrote in message
>>> news:F153F82D-E9CF-4C84-A496-(E-Mail Removed)...
>>> | Hello!
>>> | How to convert all 3d references to normal references in a workbook?
>>> | I want to move the ranges to which the 3d references refer, but the 3d
>>> | references do not follow the movement of the precedents inside the 3d
>>> range
>>> | and become corrupted.
>>> | Regards,
>>> | Dmitry
>>>
>>>
>>>

>


 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Aug 2008
One more thing I should mention... the macro I posted physically changes the
formulas in the cells and those changes cannot be undone... so, if this is
not what you actually wanted, do NOT run the macro against any live formulas
(that is, test it on a COPY of your worksheet first). If you need this code
to output a value for inclusion in a different cell than the one that
contains the formula, it would be very easy to convert the code to a UDF
(user defined function)... just let me know and I rewrite it into a UDF for
you.

Rick


"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
message news:OEWgbKN%(E-Mail Removed)...
>I should have mentioned, you need to select one or more cells (the macro
>can handle contiguous as well as non-contiguous ranges of cells) and then
>run the macro; it will then expand every 3D reference (even differing
>multiple 3D references within a single cell's formula) in every cell within
>the selection.
>
> Rick
>
>
> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
> message news:%23xDe5GN%(E-Mail Removed)...
>> Give this macro a try; place it in a Module (Insert/Module from the VBA
>> menu bar)...
>>
>> Sub Expand3dFormula()
>> Dim RE As Object
>> Dim C As Range
>> Dim WS As Worksheet
>> Dim X As Long
>> Dim Y As Long
>> Dim StartIndex As Long
>> Dim EndIndex As Long
>> Dim ShtRef As String
>> Dim ShtStart As String
>> Dim ShtEnd As String
>> Dim CelRef As String
>> Dim WSname As String
>> Dim Reference As String
>> Dim REsub As String
>> Dim Parts() As String
>> For Each C In Selection
>> Set RE = CreateObject("VBScript.RegExp")
>> RE.Global = True
>> RE.Pattern = "[^:!a-zA-Z0-9=_]"
>> REsub = RE.Replace(C.Formula & "=", " ")
>> RE.Pattern = " "
>> REsub = Trim(RE.Replace(REsub, " "))
>> Set RE = Nothing
>> Parts = Split(REsub)
>> For X = 1 To UBound(Parts) - 1
>> Reference = ""
>> If Parts(X) Like "*:*!*" Then
>> ShtRef = Left(Parts(X), InStr(Parts(X), "!") - 1)
>> CelRef = Mid(Parts(X), InStr(Parts(X), "!") + 1)
>> ShtStart = Left(ShtRef, InStr(ShtRef, ":") - 1)
>> ShtEnd = Mid(ShtRef, InStr(ShtRef, ":") + 1)
>> For Each WS In Worksheets
>> If WS.Name = ShtStart Then StartIndex = WS.Index
>> If WS.Name = ShtEnd Then EndIndex = WS.Index
>> Next
>> For Y = StartIndex To EndIndex
>> WSname = Worksheets(Y).Name
>> If WSname Like "*[!a-zA-Z_]*" Then WSname = "'" & WSname & "'"
>> Reference = Reference & WSname & "!" & CelRef
>> If Y < EndIndex Then Reference = Reference & ","
>> Next
>> C.Formula = Replace(C.Formula, Parts(X), Reference)
>> End If
>> Next
>> Next
>> End Sub
>>
>> Rick
>>
>>
>>
>> "Dima" <(E-Mail Removed)> wrote in message
>> news:45FCFF38-0949-47A7-9D15-(E-Mail Removed)...
>>> Thanks Jim for replying!
>>> Yes, I mean the way to convert this:
>>> =SUM(Sheet2:Sheet4!A1)
>>> to
>>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
>>> Dmitry
>>> "Jim Rech" wrote:
>>>
>>>> If you mean that you'd like a way to convert this:
>>>>
>>>> =SUM(Sheet2:Sheet4!A1)
>>>>
>>>> to
>>>>
>>>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
>>>>
>>>> I don't think there is anything in Excel that does it unfortunately.
>>>>
>>>> --
>>>> Jim
>>>> "Dima" <(E-Mail Removed)> wrote in message
>>>> news:F153F82D-E9CF-4C84-A496-(E-Mail Removed)...
>>>> | Hello!
>>>> | How to convert all 3d references to normal references in a workbook?
>>>> | I want to move the ranges to which the 3d references refer, but the
>>>> 3d
>>>> | references do not follow the movement of the precedents inside the 3d
>>>> range
>>>> | and become corrupted.
>>>> | Regards,
>>>> | Dmitry
>>>>
>>>>
>>>>

>>

>


 
Reply With Quote
 
Dima
Guest
Posts: n/a
 
      8th Aug 2008
Thank you, Rick!
"Rick Rothstein (MVP - VB)" wrote:

> One more thing I should mention... the macro I posted physically changes the
> formulas in the cells and those changes cannot be undone... so, if this is
> not what you actually wanted, do NOT run the macro against any live formulas
> (that is, test it on a COPY of your worksheet first). If you need this code
> to output a value for inclusion in a different cell than the one that
> contains the formula, it would be very easy to convert the code to a UDF
> (user defined function)... just let me know and I rewrite it into a UDF for
> you.
>
> Rick
>
>
> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
> message news:OEWgbKN%(E-Mail Removed)...
> >I should have mentioned, you need to select one or more cells (the macro
> >can handle contiguous as well as non-contiguous ranges of cells) and then
> >run the macro; it will then expand every 3D reference (even differing
> >multiple 3D references within a single cell's formula) in every cell within
> >the selection.
> >
> > Rick
> >
> >
> > "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
> > message news:%23xDe5GN%(E-Mail Removed)...
> >> Give this macro a try; place it in a Module (Insert/Module from the VBA
> >> menu bar)...
> >>
> >> Sub Expand3dFormula()
> >> Dim RE As Object
> >> Dim C As Range
> >> Dim WS As Worksheet
> >> Dim X As Long
> >> Dim Y As Long
> >> Dim StartIndex As Long
> >> Dim EndIndex As Long
> >> Dim ShtRef As String
> >> Dim ShtStart As String
> >> Dim ShtEnd As String
> >> Dim CelRef As String
> >> Dim WSname As String
> >> Dim Reference As String
> >> Dim REsub As String
> >> Dim Parts() As String
> >> For Each C In Selection
> >> Set RE = CreateObject("VBScript.RegExp")
> >> RE.Global = True
> >> RE.Pattern = "[^:!a-zA-Z0-9=_]"
> >> REsub = RE.Replace(C.Formula & "=", " ")
> >> RE.Pattern = " "
> >> REsub = Trim(RE.Replace(REsub, " "))
> >> Set RE = Nothing
> >> Parts = Split(REsub)
> >> For X = 1 To UBound(Parts) - 1
> >> Reference = ""
> >> If Parts(X) Like "*:*!*" Then
> >> ShtRef = Left(Parts(X), InStr(Parts(X), "!") - 1)
> >> CelRef = Mid(Parts(X), InStr(Parts(X), "!") + 1)
> >> ShtStart = Left(ShtRef, InStr(ShtRef, ":") - 1)
> >> ShtEnd = Mid(ShtRef, InStr(ShtRef, ":") + 1)
> >> For Each WS In Worksheets
> >> If WS.Name = ShtStart Then StartIndex = WS.Index
> >> If WS.Name = ShtEnd Then EndIndex = WS.Index
> >> Next
> >> For Y = StartIndex To EndIndex
> >> WSname = Worksheets(Y).Name
> >> If WSname Like "*[!a-zA-Z_]*" Then WSname = "'" & WSname & "'"
> >> Reference = Reference & WSname & "!" & CelRef
> >> If Y < EndIndex Then Reference = Reference & ","
> >> Next
> >> C.Formula = Replace(C.Formula, Parts(X), Reference)
> >> End If
> >> Next
> >> Next
> >> End Sub
> >>
> >> Rick
> >>
> >>
> >>
> >> "Dima" <(E-Mail Removed)> wrote in message
> >> news:45FCFF38-0949-47A7-9D15-(E-Mail Removed)...
> >>> Thanks Jim for replying!
> >>> Yes, I mean the way to convert this:
> >>> =SUM(Sheet2:Sheet4!A1)
> >>> to
> >>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
> >>> Dmitry
> >>> "Jim Rech" wrote:
> >>>
> >>>> If you mean that you'd like a way to convert this:
> >>>>
> >>>> =SUM(Sheet2:Sheet4!A1)
> >>>>
> >>>> to
> >>>>
> >>>> =SUM(Sheet2!A1,Sheet3!A1,Sheet4!A1)
> >>>>
> >>>> I don't think there is anything in Excel that does it unfortunately.
> >>>>
> >>>> --
> >>>> Jim
> >>>> "Dima" <(E-Mail Removed)> wrote in message
> >>>> news:F153F82D-E9CF-4C84-A496-(E-Mail Removed)...
> >>>> | Hello!
> >>>> | How to convert all 3d references to normal references in a workbook?
> >>>> | I want to move the ranges to which the 3d references refer, but the
> >>>> 3d
> >>>> | references do not follow the movement of the precedents inside the 3d
> >>>> range
> >>>> | and become corrupted.
> >>>> | Regards,
> >>>> | Dmitry
> >>>>
> >>>>
> >>>>
> >>

> >

>
>

 
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
Error when Formula references a pivot table in an external workboo baldmosher Microsoft Excel Misc 2 4th Mar 2009 09:53 AM
How to convert all 3d references to normal references in a workboo Dima Microsoft Excel Misc 6 8th Aug 2008 12:38 PM
How to convert all 3d references to normal references in a workboo Dima Microsoft Excel Worksheet Functions 6 8th Aug 2008 12:38 PM
Excel Chart-data references link another worksheet in same workboo =?Utf-8?B?V2FuZGEgSG91c2U=?= Microsoft Excel Misc 0 25th Jul 2007 03:40 PM
How can I create drop-down lists with references in other workboo. =?Utf-8?B?Q2V6YXIgRFVNSVRSSVU=?= Microsoft Excel Worksheet Functions 1 30th Mar 2005 02:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 AM.