VBA paste date to next empty column

Palucci

Banned user
Joined
Sep 15, 2021
Messages
138
Office Version
  1. 365
Platform
  1. Windows
I have a code that copies me to the next empty column, the first .range code ("B68") copies to the second row T2, I would like the next F70 under him: for example
B68> T2
F70> T3
B70> T4.

But my second code .Range("F70") pasted BGH3 and this is a penultimate column I dont know why
Rich (BB code):
wbMe.Sheets("blank3").Range("B68").Copy
wbMe.Sheets("input_6").Cells(2, Columns.Count).End(xlToLeft).Offset(0, 1).PasteSpecial Paste:=xlPasteValues
'''SUMA'''
wbMe.Sheets("sblank3").Range("F70") = wbMe.Sheets("strona 3").Range("F68").Value + wbMe.Sheets("strona 3").Range("G68").Value
wbMe.Sheets("blank3").Range("F70").Copy
wbMe.Sheets("input_6").Cells(2, Columns.Count).End(xlToLeft).Offset(0, 1).PasteSpecial Paste:=xlPasteValues
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: VBA copying and pasting date always on Next empty columns
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Try this:
(you did not give an example for B70 so you will need to update what goes on the right hand side of the equation)

VBA Code:
Sub PasteToLastEmptyColumn()

    'B68> T2
    'F70> T3
    'B70> T4 - Source data details not supplied - Palucci needs to update line

    Dim wbMe As Workbook
    Dim pasteColNew As Long
    Dim pasteRowNext As Long
    
    Set wbMe = ThisWorkbook
    
    pasteColNew = wbMe.Sheets("input_6").Cells(2, Columns.Count).End(xlToLeft).Column + 1

    wbMe.Sheets("blank3").Range("B68").Copy
    pasteRowNext = 2
    wbMe.Sheets("input_6").Cells(pasteRowNext, pasteColNew).PasteSpecial Paste:=xlPasteValues
    '''SUMA'''
    wbMe.Sheets("sblank3").Range("F70") = wbMe.Sheets("strona 3").Range("F68").Value + wbMe.Sheets("strona 3").Range("G68").Value
    wbMe.Sheets("blank3").pasteRowNext("F70").Copy
    pasteRowNext = pasteRowNext + 1
    wbMe.Sheets("input_6").Cells(pasteRowNext, pasteColNew).PasteSpecial Paste:=xlPasteValues
    
    
    wbMe.Sheets("sblank3").Range("B70") = "Palucci to fill this in"     ' <------ Needs source data to be entered
    wbMe.Sheets("blank3").pasteRowNext("B70").Copy
    pasteRowNext = pasteRowNext + 1
    wbMe.Sheets("input_6").Cells(pasteRowNext, pasteColNew).PasteSpecial Paste:=xlPasteValues
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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