Need help with my macro!

blakererucha

New Member
Joined
Feb 16, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi! I have data that I am trying to paste into the bottom of a table, but I cannot figure our how to do it. It keeps pasting into the same cell, not the bottom of the table. Here is my code.

Sub DAILY_DATA_LOG_INSERT()
'
' DAILY_DATA_LOG_INSERT Macro
' TO INSERT DATA INTO DAILY DATA LOG
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Range("N3:AH3").Select
Selection.Copy
Sheets("DAILY DATA LOG").Select
Range("B62").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub


Thank you for the help!!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
try this small change:
VBA Code:
Sub DAILY_DATA_LOG_INSERT()
'
' DAILY_DATA_LOG_INSERT Macro
' TO INSERT DATA INTO DAILY DATA LOG
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Range("N3:AH3").Select
Selection.Copy
Sheets("DAILY DATA LOG").Select
Lastrow = 1 + Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & Lastrow).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 
Upvote 0
try this small change:
VBA Code:
Sub DAILY_DATA_LOG_INSERT()
'
' DAILY_DATA_LOG_INSERT Macro
' TO INSERT DATA INTO DAILY DATA LOG
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Range("N3:AH3").Select
Selection.Copy
Sheets("DAILY DATA LOG").Select
Lastrow = 1 + Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & Lastrow).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Thanks, but im still getting an error with this.
1645039735095.png
 
Upvote 0
Do you option explicit?? if you do then you need to add a declaraton for Lastrow, e.g.
VBA Code:
dim Lastrow
I never use option explicit it just causes more problems than it saves in my opinion
 
Upvote 0
Do you option explicit?? if you do then you need to add a declaraton for Lastrow, e.g.
VBA Code:
dim Lastrow
I never use option explicit it just causes more problems than it saves in my opinion
I don't think so? I'm novice to VBA.
 
Upvote 0
I can't think of anything else because the code compiles and runs Ok on my computer so try this:
VBA Code:
Sub DAILY_DATA_LOG_INSERT()
Dim lastrow As Variant

'
' DAILY_DATA_LOG_INSERT Macro
' TO INSERT DATA INTO DAILY DATA LOG
'
' Keyboard Shortcut: Ctrl+Shift+I
'
Range("N3:AH3").Select
Selection.Copy
Sheets("DAILY DATA LOG").Select
lastrow = 1 + Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & lastrow).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I'm novice to VBA.
Unfortunatly novices are often really encouraged to use option explicit
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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