VBA Align text to the left and a ASCII character to the right on the same cell

RuiFlora

Board Regular
Joined
Feb 28, 2014
Messages
58
Hello. I am trying to make a code which hide and unhide a range of cells when I click on a specific cell.
This specific cell have a text and a ascii character (a up arrow when I hide and a down arrow when I unhide)
The code is working just fine. However, i would like to know if there is any way to align the text on the left side of the cell, and the ascii character on the right, to make it look better.

Here is the code I made:

Sub Cell_Click()
Dim country1 As Range
Dim country1_cell As Range
Dim asciiup As String
Dim asciidown As String


Set country1 = Worksheets("PC").Range("country1")
Set country1_cell = Worksheets("sheet1").Range("country1_cell")


asciiup = ChrW(8593)
asciidown = ChrW(8595)


If Range("country1").EntireRow.Hidden = True Then
country1_cell.Value = "Country" & asciiup
Range("country1").EntireRow.Hidden = False
Else
Range("country1").EntireRow.Hidden = True
region1_cell.Value = "Country" & asciidown
End If
Sheet1.Range("A1").Select
End Sub

In sum, I would like to align "Country" on the left. And asciiup/asciidown to the right, on the same cell.
Hope someone can help me!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,215,593
Messages
6,125,715
Members
449,254
Latest member
Eva146

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top