Paste Vales in same row, different columns

muzaffas

New Member
Joined
Nov 5, 2014
Messages
5
Hello, I would like to paste 3 values in 3 columns A, B, and C in the last available row.

Filename = Dir(Path & "*.xls*")
DateTimeStamp = DateTime.Now
UserName = (Environ$("Username"))
'get last AVAILABLE cell to paste into
Set iLastCellS2 = s2.Cells(s2.Rows.Count, "A").End(xlUp).Offset(1, 0)

Assume my available row is row #5 . How do I paste Filename in A5, DateTimeStamp in B5, and UserName in C5?

Appreciate your help
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
How about
Code:
iLastCellS2.Resize(, 3).Value = Array(Filename, DateTimeStamp, UserName)
 
Upvote 0
Try:

Code:
Filename = Dir(Path & "*.xls*")
DateTimeStamp = DateTime.Now
UserName = (Environ$("Username"))
s2.Cells(Rows.Count, "A").End(xlUp)(2).Resize(, 3).Value = Array(Filename, DateTimeStamp, UserName)
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,312
Messages
6,124,199
Members
449,147
Latest member
sweetkt327

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