Results 1 to 2 of 2

Thread: VB for Excel

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Argentina, Buenos Aires
    Posts
    38

    VB for Excel

    When I generate a macro to change the name of the columns of an Excel sheet from A, B, C, etc to 1, 2, 3, etc,the code that appears is:
    With Application
    .ReferenceStyle=x1R1C1
    .UserName="zzzz"
    .StandardFont'"Arial"
    .StandardFontSize="10"
    .DefaultFilePath="C:\Documents and Settings\zzzz\MyDocuments"
    .EnableSound=False
    .RollZoom=False
    End With

    and it works O.K.

    When I intend to use similar codes in a VB program I get error ( as if x1R1C1 is a variable not defined). I suspect that I need the values of the constants x1R1C1 as well as the values for x1L1C1 and x1A1.

    Can anyone give me the values of these constants...or where can I get them?
    Thanks!!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: VB for Excel

    You can get the values from Excel, just go into the VBA editor and press F2. You can then enter the name of the constant in the second drop-down, and press the button next to it.

    You will see a list of all items that match what you typed, just select the right one (if it isn't selected already), and the declaration will be shown at the bottom of the window, eg:
    VB Code:
    1. Const xlR1C1 = -4150 '(&HFFFFEFCA)

Posting Permissions

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



Click Here to Expand Forum to Full Width