LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Formatting not updating inside a function

Hi,

I have developed a basic function that will include a string value to a cell
and then format that cell's background. The string value goes in ok but the
format of the cell's background does not work. If I extract the format code
into it's own macro it updates the cell contents without a problem....can
anyone suggest where I am going wrong ?

Cell has the following values to call the function
=strDebtorDays(H5,ADDRESS(ROW(),COLUMN()))
Where H5 is 7

Function strDebtorDays(intDebtorDays As Integer, strCellReference As String)
As String
'This function will return a string value showing the number of days that
the debt has been owed

Select Case intDebtorDays

Case 0 To 7
strDebtorDays = "< 7 days"

'Update the formating of the cell we are referencing
Range(strCellReference).Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With

Case 8 To 14
strDebtorDays = "< 14 days"
Case 15 To 30
strDebtorDays = "< 30 days"
Case 31 To 60
strDebtorDays = "< 60 days"
Case 61 To 90
strDebtorDays = "< 90 days"
Case Is 90
strDebtorDays = " 90 days"
Case Else
strDebtorDays = "Not Valid Range"

End Select

End Function



 
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
INDIRECT function inside AND function Biff Excel Worksheet Functions 3 September 23rd 06 07:20 PM
match function inside if function gnotnoel Excel Programming 2 June 1st 06 07:44 PM
Nesting Networkdays function inside and If function Addison Excel Worksheet Functions 2 April 13th 06 08:04 PM
SUMIF Function Inside SUMPRODUCT Function Abdul Waheed Excel Worksheet Functions 17 September 19th 05 04:24 PM
Find and Replace formatting inside of a macro mlstjohn Excel Programming 0 November 11th 04 04:16 PM


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