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: 1
Default align text in the center of a range of cells

hi there,


i have a task to check whether a user has align some text in the range
cells from A1:F1.

so there is some text in cell A1.
then the user selects all the cells from A1:f1 and merges them and
then aligns the text center.
that is easy.

i wrote the above sub and thought would work fine but the problem is
that when someone selects the cells a1 to c1 and centers the text in
that range my sub still gives me a correct result

it should not. how can i write a sub that will give me a correct result
only when the user aligns the given text in the range from cells A1:f1
and only in that range?

please help!!


Sub center()

Set app = Application.Workbooks("budget").Worksheets("money" )

If app.Range("A1:F1").HorizontalAlignment < xlCenter Then


MsgBox "error"
Exit Sub

End If


MsgBox ("ok")
End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
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
Text won't align at bottom of cells in Excel 2007. BillCT1984 Excel Discussion (Misc queries) 1 February 19th 10 07:19 PM
align text?? L.S. New Users to Excel 3 July 30th 09 01:42 AM
How do I center numbers in a cell, but align by decimal? Juliue Excel Discussion (Misc queries) 2 January 28th 09 11:55 PM
How do I center align a title at top of sheet. vee Excel Worksheet Functions 1 September 20th 06 10:00 PM
How to center a title across a range of cells in Excel ? Ravi Excel Discussion (Misc queries) 4 June 30th 05 01:01 AM


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