Marco for Dummies

NealGowdy11

New Member
Joined
Sep 20, 2016
Messages
14
Good morning,

I am just new to macros and am struggling with one om trying to do. I have not learnt how to write macros yet so using the "record Macro" function but cant get it to do what i want.

Il screen shot what ive got so far at the end of this post.

I am trying to click a button to copy data from the below:

1630454974164.png


Into the table below on the next available row so as to not overwrite the previous month:

1630455021773.png


Is this possible? Any help would be appreciated, but please keep in mind my limited understanding.

1630455201633.png


Thank you

N
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Record Macro doesn't usually generate the most efficient code
Try this (untested so take a copy of your spreadsheet)
This copies data from Sheet1 to Sheet1, note it won't copy formats.
Change the name of "Sheet1" in the code to whatever your sheet is called.

Code:
Sub k1
Lastrow = Worksheets("Sheet1").Cells(Rows.Count, "W").End(xlUp).Row
LastRow=LastRow+1
for i=0 to 3
Worksheets("Sheet1").Cells(LastRow, 23+i)=Worksheets("Sheet1").Cells(5+i, 12)
Next i
for i=0 to 4
Worksheets("Sheet1").Cells(LastRow, 27+i)=Worksheets("Sheet1").Cells(5+i, 15)
Next i
End Sub
 
Upvote 0
Solution
My submission would be ...

VBA Code:
Public Sub NealGowdy11()

    Dim src As Range, dest As Range

    With Application.ActiveSheet

        Set src = .Range("L5:L8")
        Set dest = .Range("W16").End(xlDown).Offset(1, 0)
        src.Copy
        dest.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=True

        Set src = .Range("O5:O9")
        Set dest = dest.End(xlToRight).Offset(0, 1)
        src.Copy
        dest.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
        
        Application.CutCopyMode = False
        
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top