Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to change table's heads content with VBA?

Hi,
In excel 2007, I have a table and need to switch values in the head
cells.
(I intend to have a macro to change words(language) in the sheets'
cells and that include a tables heads.

I have a "language reference sheet" where I can refere to different
cells/words depending on what language it should swap between. I tried
with:

Sub SwapEngTo Swe
cnBusinessBenefits.Range("TAB_EffectValues[[#Headers],[Business
Benefits]]").Value = cnReference.Range("Z2").Value
'
End Sub

(The value is Swedish "VerksamhetsEffekter")

"[Business Benefits]" will next time be altered to
"VerksamhetsEffekter" and I can use:

Sub SwapSweToEng
cnBusinessBenefits.Range("TAB_EffectValues[[#Headers],
[VerksamhetsEffekter]]").Value = cnReference.Range("Y2").Value
End Sub

However, the name is still hard coded.
I try with following more flexible way to enable the option to change
words in the excel user GUI, but the syntax doesn't seem to allow a
reference:

cnBusinessBenefits.Range("TAB_EffectValues[[#Headers],
[cnReference.Range("Z2").Value]").Value =
cnReference.Range("Y2").Value

cnBusinessBenefits.Range("TAB_EffectValues[[#Headers],
[cnReference.Range("Y2").Value]").Value =
cnReference.Range("Z2").Value

I also tried to deal with it as a string:

Sub ChangeTableHeads_BusinessBenefits_EngToSwe()
cnBusinessBenefits.Range("TAB_EffectValues[[#Headers],[" &
cnReference.Range("Y2").Value & "]]").Value =
cnReference.Range("Z2").Value

End Sub
Sub ChangeTableHeads_BusinessBenefits_SweToEng()
cnBusinessBenefits.Range("TAB_EffectValues[[#Headers],[" &
cnReference.Range("Z2").Value & "]]").Value =
cnReference.Range("Y2").Value
End Sub

.... but it didn't swallow that either.


Any suggestions?

Regards
Tskogstrom
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
Can I have reference links in table's heads? tskogstrom Excel Discussion (Misc queries) 0 October 6th 08 10:47 AM
Transforming table's content/display noa Excel Worksheet Functions 4 March 28th 08 04:06 PM
Dynamically Change a Pivot Table's Data Range Dan Thorman Excel Programming 4 May 2nd 07 09:28 PM
Change Pivot Table's query bocachai Excel Programming 1 May 2nd 05 11:17 PM
Change the name of column heads from A,B, C etc to something else Steve Excel Programming 6 September 28th 04 05:34 AM


All times are GMT +1. The time now is 06:33 PM.

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"