Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Marco to change formula according to what is written in the cell

Hi

Please help me; I need help with a Marco.

I want to be able to change a certain word in the formula according to what
is written in the cell.

For example:

If a formula in Cell A3 is as follow:

='Brisbane Metro'!G12

However if I wrote €˜Gold Coast€ in Cell A1 it will change the above formula
in Cell A3 from

='Brisbane Metro'!G12

To

='Gold Coast!G12

Thank you very much for your help!!!

Please let me know if you need more information

Best regards,

Harn

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Marco to change formula according to what is written in the cell

You dont need a macro instead you can use INDIRECT()

Cell A3
=INDIRECT(A1&"!G12")

If this post helps click Yes
---------------
Jacob Skaria


"Harn88" wrote:

Hi

Please help me; I need help with a Marco.

I want to be able to change a certain word in the formula according to what
is written in the cell.

For example:

If a formula in Cell A3 is as follow:

='Brisbane Metro'!G12

However if I wrote €˜Gold Coast€ in Cell A1 it will change the above formula
in Cell A3 from

='Brisbane Metro'!G12

To

='Gold Coast!G12

Thank you very much for your help!!!

Please let me know if you need more information

Best regards,

Harn

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Marco to change formula according to what is written in the cell

Why not use Indirect?

from
='Brisbane Metro'!G12
to
=INDIRECT("'" & A1 & "'!G12")

"Harn88" wrote:

Hi

Please help me; I need help with a Marco.

I want to be able to change a certain word in the formula according to what
is written in the cell.

For example:

If a formula in Cell A3 is as follow:

='Brisbane Metro'!G12

However if I wrote €˜Gold Coast€ in Cell A1 it will change the above formula
in Cell A3 from

='Brisbane Metro'!G12

To

='Gold Coast!G12

Thank you very much for your help!!!

Please let me know if you need more information

Best regards,

Harn

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Marco to change formula according to what is written in the ce

Dear Jacob

Thank you for your reply

='Brisbane Metro'!G12 is referring to a worksheet Tab, so "Brisbane Metro"
is a tab in the workbook. Gold Coast is also another tab in a workbook.

I want to be able to replace ='Brisbane Metro'!G12 tab to ='Gold Coast'!G12
tab and return the number in that tab.

In another word I want a Marco to replace the word 'Brisbane Metro' to 'Gold
Coast' According to what input in a cell for example A1.

I hope I explain it well, please let me know if you need more information

Thank you very much!

Best regards,

Harn

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Marco to change formula according to what is written in the ce

Dear Joel

Thank you for your reply

='Brisbane Metro'!G12 is referring to a worksheet Tab, so "Brisbane Metro"
is a tab in the workbook. Gold Coast is also another tab in a workbook.

I want to be able to replace ='Brisbane Metro'!G12 tab to ='Gold Coast'!G12
tab and return the number in that tab.

In another word I want a Marco to replace the word 'Brisbane Metro' to 'Gold
Coast'! According to what input in a cell for example A1.

I hope I explain it well, please let me know if you need more information

Thank you very much!

Best regards,

Harn


"joel" wrote:

Why not use Indirect?

from
='Brisbane Metro'!G12
to
=INDIRECT("'" & A1 & "'!G12")

"Harn88" wrote:

Hi

Please help me; I need help with a Marco.

I want to be able to change a certain word in the formula according to what
is written in the cell.

For example:

If a formula in Cell A3 is as follow:

='Brisbane Metro'!G12

However if I wrote €˜Gold Coast€ in Cell A1 it will change the above formula
in Cell A3 from

='Brisbane Metro'!G12

To

='Gold Coast!G12

Thank you very much for your help!!!

Please let me know if you need more information

Best regards,

Harn



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Marco to change formula according to what is written in the ce

Please try the below

A1 = "Brisbane Metro"
A3 = INDIRECT("'" & A1&"'!G12")
now A3 should return the value of G12 from Tab "Brisbane Metro"

Now change A1 to "Gold Coast". Now the below formula will return the value
of G12 from Tab 'Gold Coast'.
A3 = INDIRECT("'" & A1 &"'!G12")


If this post helps click Yes
---------------
Jacob Skaria


"Harn88" wrote:

Dear Jacob

Thank you for your reply

='Brisbane Metro'!G12 is referring to a worksheet Tab, so "Brisbane Metro"
is a tab in the workbook. Gold Coast is also another tab in a workbook.

I want to be able to replace ='Brisbane Metro'!G12 tab to ='Gold Coast'!G12
tab and return the number in that tab.

In another word I want a Marco to replace the word 'Brisbane Metro' to 'Gold
Coast' According to what input in a cell for example A1.

I hope I explain it well, please let me know if you need more information

Thank you very much!

Best regards,

Harn

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Marco to change formula according to what is written in the ce

with activesheet
Myformula = .Range("G1").formula
NewSheet = .Range("A1")

'remove old sheet name
Mid(Myformula,instr(Myformula,"!"))
'Add New sheet name to formula
'Note the 1st string is an double quote, colon, single quote, and double quote
'the last string is a double quote, single quote, double quote
Myformula = "='" & NewSheet & "'" & Myformula
'return new formula to worksheet
..Range("G1").formula = Myformula



end with

"Harn88" wrote:

Dear Joel

Thank you for your reply

='Brisbane Metro'!G12 is referring to a worksheet Tab, so "Brisbane Metro"
is a tab in the workbook. Gold Coast is also another tab in a workbook.

I want to be able to replace ='Brisbane Metro'!G12 tab to ='Gold Coast'!G12
tab and return the number in that tab.

In another word I want a Marco to replace the word 'Brisbane Metro' to 'Gold
Coast'! According to what input in a cell for example A1.

I hope I explain it well, please let me know if you need more information

Thank you very much!

Best regards,

Harn


"joel" wrote:

Why not use Indirect?

from
='Brisbane Metro'!G12
to
=INDIRECT("'" & A1 & "'!G12")

"Harn88" wrote:

Hi

Please help me; I need help with a Marco.

I want to be able to change a certain word in the formula according to what
is written in the cell.

For example:

If a formula in Cell A3 is as follow:

='Brisbane Metro'!G12

However if I wrote €˜Gold Coast€ in Cell A1 it will change the above formula
in Cell A3 from

='Brisbane Metro'!G12

To

='Gold Coast!G12

Thank you very much for your help!!!

Please let me know if you need more information

Best regards,

Harn

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
Change dollar amt to written form Shihachi Excel Discussion (Misc queries) 4 December 18th 09 02:13 PM
Identify if Cell is Formula or written number Claes G Excel Worksheet Functions 13 December 5th 07 05:01 PM
Worksheet selection change (running marco when cell selected) keri Excel Programming 4 June 8th 07 10:52 AM
using the name of a worksheet written in a cell, inside a formula Using the name of a worksheet written in Excel Worksheet Functions 2 March 6th 06 10:29 PM
Is there a formula to change number value to the written value? Ginny@apl Excel Discussion (Misc queries) 3 February 23rd 06 02:39 AM


All times are GMT +1. The time now is 02:35 AM.

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"