View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eddy Stan Eddy Stan is offline
external usenet poster
 
Posts: 151
Default UDF help to centre and bold

Hi

sub Banlisting() ' given 2 lines of my macro

Instead of the following two lines, can there be a UDF to center, bold, like
given below

sh1.Cells(rw, 6) = cell.Offset(0, 10) ' Date
sh1.Cells(rw, 6).HorizontalAlignment = xlCenter
sh1.Cells(rw, 6).Font.Bold = True

Is it possible:
CenterAndBold(sh1.Cells(rw, 6)) = cell.Offset(0, 10) ' Date
end sub

Function CenterAndBold(somevalue) ' number, string or date
With Selection
.HorizontalAlignment = xlCenter
.font.bold = True
End With
End Function