Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
lil_ern63
 
Posts: n/a
Default Reference Cell in custom format????


I am trying to reference another cell in the custom format area. how it
is seet up currently, I have a column (A) that will have the quantity,
column (B) has the unit of the quantity, and column (C) has the unit
price, followed by column (D) that will have the total cost of the
object (i.e. column A * C = D)

I am trying to have column C set up so all I have to do is type the
unit price but the custom format of the cell will change the value to
include the label that is in the column next to it (B).......currently
for examples sake, I am trying to set the unit price to 50, and the
unit of the quantity will be tons. ideally the result after simply
imputting 50 into the cell it will display $50/ton.

I could get it to display this simply for this case, by changing the
custom format of the cell, but since the units will change from ton to
sf. or lf....etc I am looking for a more permanent
solution.......Please help!


--
lil_ern63
------------------------------------------------------------------------
lil_ern63's Profile: http://www.excelforum.com/member.php...o&userid=23219
View this thread: http://www.excelforum.com/showthread...hreadid=400974

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I don't think you'll get your custom formatting to work that way.

But you could use an event macro that looks for changes in column B and formats
column D accordingly:

If you want to try, right click on the worksheet tab that should have this
behavior. Select view code and paste this into the code window.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Dim myRng As Range
Dim myStr As String

Set myRng = Nothing
On Error Resume Next
Set myRng = Intersect(Target, Me.Range("b:b"), Me.UsedRange)
On Error GoTo 0

If myRng Is Nothing Then
Exit Sub
Else
For Each myCell In myRng.Cells
If myCell.Value = "" Then
myStr = "General"
Else
myStr = "$0.00""/" & myCell.Value & """"
End If
myCell.Offset(0, 2).NumberFormat = myStr
Next myCell
End If

End Sub

And then back to excel to test it out.

lil_ern63 wrote:

I am trying to reference another cell in the custom format area. how it
is seet up currently, I have a column (A) that will have the quantity,
column (B) has the unit of the quantity, and column (C) has the unit
price, followed by column (D) that will have the total cost of the
object (i.e. column A * C = D)

I am trying to have column C set up so all I have to do is type the
unit price but the custom format of the cell will change the value to
include the label that is in the column next to it (B).......currently
for examples sake, I am trying to set the unit price to 50, and the
unit of the quantity will be tons. ideally the result after simply
imputting 50 into the cell it will display $50/ton.

I could get it to display this simply for this case, by changing the
custom format of the cell, but since the units will change from ton to
sf. or lf....etc I am looking for a more permanent
solution.......Please help!

--
lil_ern63
------------------------------------------------------------------------
lil_ern63's Profile: http://www.excelforum.com/member.php...o&userid=23219
View this thread: http://www.excelforum.com/showthread...hreadid=400974


--

Dave Peterson
  #3   Report Post  
lil_ern63
 
Posts: n/a
Default


I appreciate the comment, but I am still unable to get output of the
cell to work, once again thank you for the try however.


--
lil_ern63
------------------------------------------------------------------------
lil_ern63's Profile: http://www.excelforum.com/member.php...o&userid=23219
View this thread: http://www.excelforum.com/showthread...hreadid=400974

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

What did you try?

lil_ern63 wrote:

I appreciate the comment, but I am still unable to get output of the
cell to work, once again thank you for the try however.

--
lil_ern63
------------------------------------------------------------------------
lil_ern63's Profile: http://www.excelforum.com/member.php...o&userid=23219
View this thread: http://www.excelforum.com/showthread...hreadid=400974


--

Dave Peterson
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
cell custom format mark kubicki Excel Worksheet Functions 1 August 25th 05 02:59 AM
Cell will not format numbers correctly for a 13 digit custom barc. Laudan Excel Worksheet Functions 4 April 11th 05 08:13 PM
Enter an Excel cell reference as part of a custom header/footer Suegi123 Excel Worksheet Functions 1 April 1st 05 10:55 PM
how to create a variable column in cell reference Sampson Excel Worksheet Functions 3 February 21st 05 10:13 PM
How do I format a value when using it within a cell reference tha. packmule Excel Worksheet Functions 4 February 3rd 05 09:32 PM


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