+ Reply to Thread
Results 1 to 3 of 3

Macro for formatting existing sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    05-27-2015
    Location
    Zagreb
    MS-Off Ver
    2010
    Posts
    36

    Macro for formatting existing sheet

    Dear all,

    Every month I get workbook formatted on certain way (same way, maybe few rows more or less). However, I need to reformat it and add some additional calculations. Please find attached file with input sheet and output sheet.

    I would like to aviod manual adjustments in input file, but recording a macro did not work well either.

    Is there a code that would do the trick?

    Thank you,

    TanjaFormatting.xlsx

  2. #2
    Forum Contributor
    Join Date
    09-26-2014
    Location
    Moscow, Russia
    MS-Off Ver
    MSE 10, MSE 13
    Posts
    179

    Re: Macro for formatting existing sheet

    Hello, Tanja!

    How about fast solution? If you will press button in the attachment - you'll see deletion of unneeded rows. Works well, if your data every time have the same amount of columns and starts from 5-th row. Part with formulas behind "AK" column is not done yet, but if this button is appropriate for you - it will be easy to add.

    Sub Rio_Clean()
        Dim RowX As Integer, RowY As Integer, i As Integer
        With ThisWorkbook.ActiveSheet
            RowX = .Cells(.Cells.Rows.Count, 37).End(xlUp).Row
            RowY = .UsedRange.Row + .UsedRange.Rows.Count - 1
            If RowX < 5 Then Exit Sub
            If RowX < RowY Then .Rows((RowX + 1) & ":" & RowY).Delete
            For i = RowX To 5 Step -1
                Select Case .Cells(i, 37).Value
                    Case "", "Check"
                        .Rows(i).Delete
                    Case Else
                        If .Cells(i, 1).Value = "" Then
                            .Rows(i).Delete
                        End If
                End Select
            Next i
        End With
    End Sub
    Attached Files Attached Files
    Best wishes and have a nice day!

  3. #3
    Registered User
    Join Date
    05-27-2015
    Location
    Zagreb
    MS-Off Ver
    2010
    Posts
    36

    Re: Macro for formatting existing sheet

    it works great

+ 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. Macro: Add data from new sheet to existing sheet within a workbook
    By Droopy01 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2014, 02:50 PM
  2. Have existing formatting code. Need to add macro to new workbook.
    By PeteABC123 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-07-2014, 11:36 AM
  3. Macro to save each sheet with existing name and to the location specified
    By vivek_work in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2013, 08:21 AM
  4. Distributing a macro or new sheet to existing workbooks
    By runswick in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2013, 01:52 PM
  5. Editing Cell Formatting in an Existing (Damaged?) Macro
    By enturbulator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2012, 02:08 PM
  6. Macro to add new rows with information to add in existing sheet
    By htariq12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-10-2009, 08:39 AM
  7. Replies: 1
    Last Post: 08-15-2009, 05:52 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