Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 4 of 4

Thread: Vertical Alignment in Macros - [SOLVED]

  1. #1
    Join Date
    17th May 2003
    Posts
    2
    Hello,

    I'd be very grateful indeed for any help you can give me - this silly little problem is driving me mad!

    I work in the wine trade and often send out offers of wines in Excel with tasting notes. I do this so often that I've written a macro to format the notes for me, to save time doing it myself.

    My little macro works really well, except it won't set the vertical alignment to the top. The error message I receive says:

    Run Time Error '1004'

    Unable to set the VerticalAlignment property of the Range class.

    My code is below - can someone please tell me what I'm doing wrong??

    Sub FormatNotes()
    Dim i As Long
    For i = 4 To 200
    If Cells(i, 1) <> "" And Cells(i, 2) = "" And Cells(i, 4) = "" Then
    Range(Cells(i, 1), Cells(i, 8)).Select
    With Selection
    .Font.Italic = True
    .WrapText = True
    .MergeCells = True
    .VerticalAlignment = x1VAlignTop
    End With
    End If
    Next i

    End Sub

    ps - if anyone ever needs anything translated from french into english - let me know

    Kind regards, and thanks lots in advance for any help,

    Victoria

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    11th February 2003
    Posts
    108
    I&#039;m guessing that instead of:

    VB:
    .VerticalAlignment = x1VAlignTop 
    
    
    you want:

    VB:
    .VerticalAlignment = xlVAlignTop 
    
    
    I changed the "1" for an "l".

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    17,916
    You could try ;

    .VerticalAlignment = xlTop

    Roy

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    17th May 2003
    Posts
    2
    It works!! Thank you all so much!

    I&#039;m learning from a book, so I thought they were x one properties, instead of x L properties!

    What a relief.

    Thanks again

    Kind regards,

    Victoria

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. horizontal & vertical alignment
    By ron centner in forum EXCEL HELP
    Replies: 2
    Last Post: October 20th, 2004, 06:21
  2. Vertical Alignment Center by Default?
    By tdang in forum EXCEL HELP
    Replies: 1
    Last Post: October 6th, 2004, 03:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno