Roman F
asked on
Help with Excel VBA
i have an excel file. How to :
1. how to aligh left the first column, center the second column, the rest of columns should be right
2. how to make auto width for all cells
1. how to aligh left the first column, center the second column, the rest of columns should be right
2. how to make auto width for all cells
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much, got the idea
last question
how to add the border around the area, i want the whole area, and numbers of rows always is different
when i record a macro it put the border around the existing data...
last question
how to add the border around the area, i want the whole area, and numbers of rows always is different
when i record a macro it put the border around the existing data...
rfedorov,
I would suggest implementing conditional formatting in your worksheet so that if the cell is not blank then it gets borders.
Let me know if you have questions.
I would suggest implementing conditional formatting in your worksheet so that if the cell is not blank then it gets borders.
Let me know if you have questions.
ASKER
no, there is no a chance that the cells will be blank
Are you saying your worksheet has no blank cells? If so, then I'm confused about your statement,
"i want the whole area, and numbers of rows always is different
when i record a macro it put the border around the existing data..."
What is the existing data? And if there is not existing data, wouldn't that mean some cells are blank?
However, if its true that there are no blank cells anywhere on your worksheet, I think the best solution is still implementing conditional formatting on your worksheet. The condition does have to be if the cell is blank, it could be whatever you want it to be in order to get borders around your cells.
"i want the whole area, and numbers of rows always is different
when i record a macro it put the border around the existing data..."
What is the existing data? And if there is not existing data, wouldn't that mean some cells are blank?
However, if its true that there are no blank cells anywhere on your worksheet, I think the best solution is still implementing conditional formatting on your worksheet. The condition does have to be if the cell is blank, it could be whatever you want it to be in order to get borders around your cells.
ASKER
it could be 12 row of data, it could be 2 rows of data
That's what I mean, if there are two rows of data, then there are many, many blank cells in the remaining rows. However, I'm getting that you dont want to use conditional formatting so I'm playing with my solution to see if I can incorporate your needs.
ASKER
ok,
let say i have a Range
Range("A3:C20").Select
'''
With Selection.Borders(xlEdgeLe ft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
this is working but i want to make excel understand, that it should select all data in the sheet and put the border around it....
let say i have a Range
Range("A3:C20").Select
'''
With Selection.Borders(xlEdgeLe
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
this is working but i want to make excel understand, that it should select all data in the sheet and put the border around it....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this...
Open in new window