Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Copy the format of a cell reference

I have cells in my spreadsheet that list other cell addresses (i.e. they
contain text in the format "WorksheetName!CellNumber"... for example
"Worksheet1!C33")

How can I programatically (or with the use of a function) copy the format of
the actual reference cell to the cell containing the text reference.

More specifically, if the remote cell is yellow, I want the local cell to
also become yellow.

I hope this makes sense.

Thanks for your help.

Jim Arnold
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Copy the format of a cell reference

In the following example the parameter ReferenceCell would be the cell that
contains your reference text:

Sub FCopy(ReferenceCell as Range)
Dim SheetName as String, CellRef as String, EPos as Integer
Dim RemoteCell as Range

With ReferenceCell
EPos = InStr(.Text, "!")
If EPos < 0 Then
SheetName = Left(.Text, EPos-1)
CellRef = Right(.Text, Len(.Text)-EPos)
Set RemoteCell = WorkSheets(SheetName).Range(CellRef)
RemoteCell.Copy
.PasteSpecial xlPasteFormats
End If
End With

End Sub
--
- K Dales


"Jim" wrote:

I have cells in my spreadsheet that list other cell addresses (i.e. they
contain text in the format "WorksheetName!CellNumber"... for example
"Worksheet1!C33")

How can I programatically (or with the use of a function) copy the format of
the actual reference cell to the cell containing the text reference.

More specifically, if the remote cell is yellow, I want the local cell to
also become yellow.

I hope this makes sense.

Thanks for your help.

Jim Arnold

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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
How do I use a relative cell reference that will copy the format? Brian Excel Discussion (Misc queries) 4 January 13th 09 10:49 PM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
how to reference/copy cell format ??? [email protected] Excel Discussion (Misc queries) 3 August 1st 06 08:02 AM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM


All times are GMT +1. The time now is 04:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"