+ Reply to Thread
Results 1 to 4 of 4

VBA Format Multiple Ranges & LastRow

Hybrid View

hobbiton73 VBA Format Multiple Ranges &... 11-25-2013, 06:47 AM
hudibyk Re: VBA Format Multiple... 11-25-2013, 06:50 AM
ragulduy Re: VBA Format Multiple... 11-25-2013, 06:51 AM
hobbiton73 Re: VBA Format Multiple... 11-25-2013, 07:45 AM
  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Format Multiple Ranges & LastRow

    Hi, I wonder whether someone may be able to help me please.

    I'm trying to put together a very small script which applied formatting to muliple ranges from the 'StartRow' to the 'LastRow'.

    The code below is what I've put together so far, but I receive a error when running this.

        LastRow = Cells(Rows.count, "B").End(xlUp).Row
            If LastRow >= StartRow Then
                With Range("B7:D, G7:H, M7:U" & LastRow)
                    With .Font
                        .Name = "Lucida Sans"
                        .Size = 10
                    End With
                End With
            End If
    I know that the issue is this line
    With Range("B7:D, G7:H, M7:U" & LastRow)
    but I'm not too sure how to get around it.

    I just wondered whether someone may be able to look at this please and let me know where I'm going wrong.

    Many thanks and kind regards

  2. #2
    Registered User
    Join Date
    09-24-2013
    Location
    Poland
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: VBA Format Multiple Ranges & LastRow

    With Range("B7:D" & LastRow & ", G7:H" & LastRow & ", M7:U" & LastRow)

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA Format Multiple Ranges & LastRow

    I think that you need
    Range("B7:D" & LastRow & ",G7:H" & LastRow & ",M7:U" & LastRow)

  4. #4
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Format Multiple Ranges & LastRow

    Hi @yudlugar and @hudibyk, thank you both for taking the time to reply to my post and for the solution.

    I didn't realise it would be that simple.

    All the best and kind regards

+ 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. [SOLVED] VBA Format Multiple Ranges
    By hobbiton73 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-22-2013, 05:18 AM
  2. Email 2 array ranges with LastRow argument
    By scooby99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2011, 09:25 AM
  3. Put a conditional format into a LastRow code
    By WasWodge in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-27-2011, 12:00 AM
  4. LastRow and Multiple Ranges
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-21-2010, 09:21 AM
  5. LastRow format
    By Ken Scanlon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2005, 02:21 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