Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking two cells


Hi,

I have two cells in two different worksheets. One cell is referenced by
a range variable called wagNDCell. The second cell is referenced by a
different range variable called wagDetCell. I would like to link
wagDetCell to wagNDCell, so I tried wagDetCell.Formula = wagNDCell but
that didn't work because wagNDCell returns the value of the cell. How
do I create this link? Thanks in advance.

Raman


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396511

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Linking two cells

Use the Set keyword:
Set wagDetCell = wagNDCell
will mean that wagDetCell references the same cell as wagNDCell
--
Thanks

Simon


"Raman325" wrote:


Hi,

I have two cells in two different worksheets. One cell is referenced by
a range variable called wagNDCell. The second cell is referenced by a
different range variable called wagDetCell. I would like to link
wagDetCell to wagNDCell, so I tried wagDetCell.Formula = wagNDCell but
that didn't work because wagNDCell returns the value of the cell. How
do I create this link? Thanks in advance.

Raman


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396511


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking two cells


That will change the location of wagDetCell though. I would just like
the value of the cell represented by wagDetCell to be determined by the
value of the cell represented by wagNDCell. I would like to have an
actual link there so that if the value of wagNDCell changes, so does
the value of wagDetCell. Sorry for the misunderstanding, and thanks for
your help.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396511

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking two cells


After searching Google for a while, I finally found the followin
snippet of code at http://www.freevbcode.com/ShowCode.asp?ID=4303


Code
-------------------
Function ColumnLetter(ColumnNumber As Integer) As String
If ColumnNumber 26 Then

' 1st character: Subtract 1 to map the characters to 0-25,
' but you don't have to remap back to 1-26
' after the 'Int' operation since columns
' 1-26 have no prefix letter

' 2nd character: Subtract 1 to map the characters to 0-25,
' but then must remap back to 1-26 after
' the 'Mod' operation by adding 1 back in
' (included in the '65')

ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _
Chr(((ColumnNumber - 1) Mod 26) + 65)
Else
' Columns A-Z
ColumnLetter = Chr(ColumnNumber + 64)
End If
End Functio
-------------------


This code allows me to get the column letter based on the column numbe
so I can use the Column and Row property of wagNDCell to determine th
cell name. Thanks agian for your help

--
Raman32
-----------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...fo&userid=2474
View this thread: http://www.excelforum.com/showthread.php?threadid=39651

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Linking two cells

You could also use this:
wagDetCell.Formula="=" & wagNDCell.Address(External:=True)
--

Simon


"Raman325" wrote:


After searching Google for a while, I finally found the following
snippet of code at http://www.freevbcode.com/ShowCode.asp?ID=4303


Code:
--------------------
Function ColumnLetter(ColumnNumber As Integer) As String
If ColumnNumber 26 Then

' 1st character: Subtract 1 to map the characters to 0-25,
' but you don't have to remap back to 1-26
' after the 'Int' operation since columns
' 1-26 have no prefix letter

' 2nd character: Subtract 1 to map the characters to 0-25,
' but then must remap back to 1-26 after
' the 'Mod' operation by adding 1 back in
' (included in the '65')

ColumnLetter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _
Chr(((ColumnNumber - 1) Mod 26) + 65)
Else
' Columns A-Z
ColumnLetter = Chr(ColumnNumber + 64)
End If
End Function
--------------------


This code allows me to get the column letter based on the column number
so I can use the Column and Row property of wagNDCell to determine the
cell name. Thanks agian for your help.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396511




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Linking two cells


Ah, that is exactly what I was looking for. Thanks for your help, I like
that one better.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=396511

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
Linking cells Caroline Excel Discussion (Misc queries) 5 November 20th 08 06:37 PM
Linking cells into empty cells in another worksheet Bookworm Excel Discussion (Misc queries) 6 October 14th 07 11:11 AM
Linking cells with a diffrent sheet with 2 cells Angelofdoom Excel Worksheet Functions 2 February 15th 06 04:20 PM
Linking a horizontal set of cells to a vertical sets of cells Russell-stanely Charts and Charting in Excel 2 October 21st 05 03:19 PM
linking cells justin Excel Worksheet Functions 1 April 26th 05 09:58 PM


All times are GMT +1. The time now is 12:58 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"