+ Reply to Thread
Results 1 to 3 of 3

VBA to format row 2 and last column

  1. #1
    Registered User
    Join Date
    04-30-2017
    Location
    Pretoria, South Africa
    MS-Off Ver
    2013
    Posts
    54

    VBA to format row 2 and last column

    I am trying this vba code that is not working =_=

    I am changing the format of row 2 and the last column

    Please Login or Register  to view this content.
    This gives me a compile error on the bolded part above (.columns)

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA to format row 2 and last column

    Hi,

    Remove the . before the Columns.Count.

    Incidentally it's not good practice to use the sheet tab name in VBA code. The tab name is too easily changed and a procedure that relies on it will crash.
    Instead use the VBA sheet code name.

    e.g.
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-30-2017
    Location
    Pretoria, South Africa
    MS-Off Ver
    2013
    Posts
    54

    Re: VBA to format row 2 and last column

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Remove the . before the Columns.Count.

    Incidentally it's not good practice to use the sheet tab name in VBA code. The tab name is too easily changed and a procedure that relies on it will crash.
    Instead use the VBA sheet code name.

    e.g.
    Please Login or Register  to view this content.
    I feel like a foo.... thanks Richard!

    your point on sheet tab in VBA is noted!

    Thanks again bro

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. vba code to format a column to a specific format (SSSS X1111111)
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2017, 03:16 PM
  2. [SOLVED] Change the format in column O depending on other columns format
    By gandreso in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2016, 04:32 AM
  3. Macro need Arranging column data in Quiz format using transpose and Text to Column Feature
    By successramesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2014, 02:58 AM
  4. [SOLVED] Change Format of Column to Phone Format
    By basketball2524 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2013, 10:38 AM
  5. Replies: 1
    Last Post: 03-02-2013, 05:06 AM
  6. Match column between two sheets and copy row format once column number matches
    By kapil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2010, 07:54 AM
  7. How to format percentage column as a number format
    By acsishere in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-25-2008, 04:12 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1