Border and SaveAs Problem

  • I am currently producing an automated spreadsheet for work that will take info in Exel form and will convert it into a set format.

    The prob I am having is..... I take one set of data and put a border around it (in a macro) and then colour the appropriate columns. However, when I choose another set of data and run the macro the border does not fit around the new adata as it is has less or more do I automate this so that everytime a new set of dat is run then the border automatically fits around the data.

    Also, I would like to "Save As" the bottom text of the data, now as the data will have different rows as before how do I automate this so it save's as the bottom line (basically what I want is soemthing to say, last txt in column A = whatever, so save as this.


  • Hello,

    you propably had already the solution, you only had to delete the "range" code in your macro-code.

    I've uploaded an example which colors and put a border around the selection you make(press button).

    Hope this helps solving your first problem.

    (Need more info for your second problem: save as...? workbook , copy line???)


    Sub Macro1()
    Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous
    Selection.Borders(xlEdgeTop).LineStyle = xlContinuous
    Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous
    Selection.Borders(xlEdgeRight).LineStyle = xlContinuous
    Selection.Interior.ColorIndex = 6 (yellow)
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!