+ Reply to Thread
Results 1 to 14 of 14

Formating a Range

  1. #1
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Formating a Range

    Hi I want to format a range of cells in VBA, but I dont know how to go about it! I need to format coloums A to I from row 8 onwards. I wnat to apply a shading format to every other row. Is this possible? Many thanks

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    Use conditional formatting. See http://www.xldynamic.com/source/xld.CF.html#rows

  3. #3
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Formating a Range

    OK but how do I apply that in a VBA enviroment

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    You don't need to.

  5. #5
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Formating a Range

    The problem is that the sheet is getting populated from another worksheet and it copys the rows straight in, including any row striping. Because it dosent copy all rows. just the ones that I want, I finish up with some consecutive row shading.

    I was thinking that if it was coded for the formating to happen after I had inserted the rows (via a button on the first sheet) then that would correct it.

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Formating a Range

    Bob thanks for your help so far but where do I insert this please? This is my code that I am using to update my sheet: Note: I just coipied the code that you had written anfd then added the 'ProcessData' at the end of my code!
    Please Login or Register  to view this content.
    Last edited by dadrew; 09-05-2012 at 09:02 AM.

  8. #8
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    I think this should do it

    Please Login or Register  to view this content.

  9. #9
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    BTW, you are just 45 miles up the road from me.

  10. #10
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Formating a Range

    Got an error on the line
    Please Login or Register  to view this content.
    Compile error: For control variable already in use.

  11. #11
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    Sorry, sloppy

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Formating a Range

    Thats cool the only problem is, is that it odes the whole row, whereas I only need it up to coloum "L". Apart from that it works well!

  13. #13
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Formating a Range

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    01-23-2012
    Location
    Warminster, England
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Formating a Range

    Hi Bob, worked a treat once I had reaised that I had given you incorrect information Doh!! I told you it needed to start at line 8 and it was actually line 3!

    I now need to format the borders, double lines around the outside of the range and single lines for the cells themslves.
    Last edited by dadrew; 09-05-2012 at 05:27 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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