Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default UDF help to centre and bold


You'rte nearly theFunction CenterAndBold(somerange)
With somerange
.HorizontalAlignment = xlCenter
.Font.Bold = True
End With
End Function

Sub test()
CenterAndBold Selection
For i = 1 To 13 Step 2
CenterAndBold Cells(i, 2)
Next
End Sub
It won't work as a worksheet function though.

Perhaps you're looking for the likes of:If
sh1.Cells(rw, 6) = cell.Offset(0, 10) Then CenterAndBold sh1.Cells(rw,
6)
which should also work.


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=130222

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default UDF help to centre and bold

HI

I have checked something in the rng and then only i am copy data from sh to
sh1 (ws)
so now for some cells i need to put in bold & color, something like that to
highlight the difference.
so i cannot use "if" in the copying statements, how to do that

Regards,
Stan





"p45cal" wrote:


You'rte nearly theFunction CenterAndBold(somerange)
With somerange
.HorizontalAlignment = xlCenter
.Font.Bold = True
End With
End Function

Sub test()
CenterAndBold Selection
For i = 1 To 13 Step 2
CenterAndBold Cells(i, 2)
Next
End Sub
It won't work as a worksheet function though.

Perhaps you're looking for the likes of:If
sh1.Cells(rw, 6) = cell.Offset(0, 10) Then CenterAndBold sh1.Cells(rw,
6)
which should also work.


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=130222


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default UDF help to centre and bold


I'm sorry, I don't understand at all what you're wanting.


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=130222

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default UDF help to centre and bold

sorry my mistake.

see i have data sheet of 4000 rows
i want to pull(copy) for specific entries and show in another sheet
i have put at b1 - one pull down list (validation)
i have put a button in this sheet - "Process"
and stored a list in that.
when the customer is selected in range(b1) and then when pressed "ok" button
then the list is generated. In the list i want specific cells be "bold "
(such as bill number, date, etc.,)

but instead of writing code for each row i want VB code to generate
the list



"p45cal" wrote:


I'm sorry, I don't understand at all what you're wanting.


--
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?userid=558
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=130222




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
Alphabetically list of last names: BOLD, not bold Lerner Excel Discussion (Misc queries) 16 March 1st 09 07:46 PM
Alphabetically list of names BOLD and NOT bold Lerner Excel Discussion (Misc queries) 13 March 1st 09 02:37 PM
conditional formating bold is true not bold false how victorio0704 Excel Programming 4 June 25th 08 04:29 PM
Join bold and non-bold text in one cell bkincaid Excel Discussion (Misc queries) 3 March 21st 06 12:58 AM
How do I get "centre across selection" to centre properly? Marjon Excel Discussion (Misc queries) 5 March 17th 06 12:24 AM


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