+ Reply to Thread
Results 1 to 4 of 4

formula for columns

  1. #1
    Registered User
    Join Date
    09-13-2019
    Location
    wales
    MS-Off Ver
    2016
    Posts
    11

    Question formula for columns

    hi all, can you help please, i am exporting a table from access to excel , this is working ok , what i am now trying to do it just place a top border only on the columns, the number of columns can change as the table can change before export , i have a DIM set up to count the number of columns, [Dim col as integer] this also works , the code i have been using is
    .Range("b2:h2").Borders(xlEdgeTop).LineStyle = XlLineStyle.xlContinuous
    but i need the value in col to reflect what column to end the borders on, so if col is 5 then the formula would change to ("b2:h2"), (column 5),
    if col is 10 then the formula would be ("b2:j2"), (column 10), how do i change the second part of the formula in vba to reflect what is stored in col? .
    please remember i am a newbie and this might need explaining as to how any solution works

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: formula for columns

    Hi mcsparron,

    Try below code ...
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  3. #3
    Registered User
    Join Date
    09-13-2019
    Location
    wales
    MS-Off Ver
    2016
    Posts
    11

    Re: formula for columns

    thanks nankw83, works a treat

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,713

    Re: formula for columns

    Glad to help & thanks for the added Rep.

    If that takes care of your question, please take a moment & mark this thread as [SOLVED] from the Thread Tools above your first post

+ 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. Replies: 6
    Last Post: 09-21-2016, 04:21 PM
  2. Replies: 2
    Last Post: 07-08-2014, 08:53 AM
  3. Replies: 0
    Last Post: 05-22-2014, 08:10 AM
  4. Replies: 6
    Last Post: 05-30-2013, 04:58 PM
  5. Increment columns in INDEX and MATCH formula - ROWS and COLUMNS
    By nickmangan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2012, 10:38 AM
  6. Replies: 1
    Last Post: 04-06-2012, 12:24 AM
  7. Formula to align two columns with nearly similar text and attached numeric columns
    By Benefits Recon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2012, 12:03 AM

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