ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Select Case with HorizontalAlignment (https://www.excelbanter.com/excel-programming/378467-excel-select-case-horizontalalignment.html)

Derrick Salmon

Excel Select Case with HorizontalAlignment
 
I'm trying to use Select Case to determine if a cell's text is aligned
to the right or the left and check that the cell is not empty ... and
am having no luck.

Can someone suggest a code fragment

thanks


Derrick


Satish

Excel Select Case with HorizontalAlignment
 
Derrick:

You can use this code to see if the text in cell A1 is left, right or
center aligned
Private Sub CommandButton1_Click()

Select Case Worksheets(1).Range("A1").HorizontalAlignment

Case xlRight
MsgBox "right"
Case xlLeft
MsgBox "left"
Case xlCenter
MsgBox "center"

End Select

End Sub

HTH
-Satish

Derrick Salmon wrote:
I'm trying to use Select Case to determine if a cell's text is aligned
to the right or the left and check that the cell is not empty ... and
am having no luck.

Can someone suggest a code fragment

thanks


Derrick




All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com