• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Format selected cell(s) with border

rbobcat1

Member
Having problem getting the code to work to create a dark bottom border on cells I select;
The Range will only process in the "A1105:G1105" row of my sheet.
I want it to work on whatever Row/Cell(s) I select.

>>> use code - tags <<<
Code:
'Sub DarkUnderscore()
'
' DarkUnderscore Macro
' create dark underscore in selected cell(s)
'
' Keyboard Shortcut: Ctrl+d
'
    Range("A1105:G1105").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
~ ~ ~ ~ ~
rest of code is in attached txt file.
 

Attachments

  • dark underscore using vba.txt
    1.4 KB · Views: 3
Last edited by a moderator:
rbobcat1
Have You tried to remove Range("A1105:G1105").Select from Your code?
Of course, You can do what do You want to do ...
My idea was to r-e-m-o-v-e that whole line
... then Your selection is done before You'll run that code.
If You left ... as You have done ... then of course, that doesn't work!
 
Did You select manually Your wanted selection before You run that code?
Now I even checked You txt-file ...
>> Why did You pasted ... 'something' with Your thread?
If You make a selection from Your sheet
and
after that run Your Example ... it ... works as it has written!
= I selected those five cells and run Example ...
Screenshot 2020-09-11 at 19.24.56.png what is Your point ... challenge?
 
Last edited:
I deleted the current module and started over then deleted the line like you recommended and it worked
Thank you..
Point... Challenge... confused.
 
Back
Top