Forum Discussion

A_SIRAT's avatar
A_SIRAT
Iron Contributor
Apr 13, 2023
Solved

help with a vba macro

Hi,

 

I have attached a sample file with explanations. I need to be copying data everyday to the records sheet and a macro button would ease the work.

  • A_SIRAT 

    Try this:

    Sub ProcessDailyRequistion()
        Dim m As Long
        Dim s As Range
        Dim t As Range
    
        With Sheets("Data Entry")
            m = .Range("B15").End(xlUp).Row
            Set s = .Range("A2:E" & m)
        End With
    
        With Sheets("Records")
            Set t = .Range("A" & .Rows.Count).End(xlUp).Offset(1).Resize(m - 1, 5)
        End With
    
        t.Value = s.Value
    End Sub
  • A_SIRAT 

    Try this:

    Sub ProcessDailyRequistion()
        Dim m As Long
        Dim s As Range
        Dim t As Range
    
        With Sheets("Data Entry")
            m = .Range("B15").End(xlUp).Row
            Set s = .Range("A2:E" & m)
        End With
    
        With Sheets("Records")
            Set t = .Range("A" & .Rows.Count).End(xlUp).Offset(1).Resize(m - 1, 5)
        End With
    
        t.Value = s.Value
    End Sub

Resources