Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Horizontal alignment

Status
Not open for further replies.

lostcause

MIS
Joined
May 23, 2001
Messages
1
Location
CA
I have an access module that opens an excel spreadsheet and writes informtion to it. I need to set the alignment on some cells so that they are right aligned(some will also be centered).
When I use the example below and it hits the horizontalalignment property I get 'runtime error 1004 unable to set the Horizontalalignement of the range class.'
Does anyone have any ideas how this can be done?




With Sheet.cells(j, i + 1)
.HorizontalAlignment = xlRight
.VerticalAlignment = xlbottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
End With
 

Have you tried this...

With Sheet.cells(j, i + 1)
With SELECTION
.HorizontalAlignment = xlRight
.VerticalAlignment = xlbottom
.WrapText = False
.Orientation = 0
.ShrinkToFit = False
.MergeCells = False
End With
End With

Trisha
padinka@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top