VBA Offset

Brom27

New Member
Joined
Feb 23, 2017
Messages
1
Good afternoon,

Just a quick question regarding VBA,
I would like to have three buttons that are programmed to enter the results of A2:D2 depending on what trial the results are from, and paste them to a database on a separate sheet.

One way around this I believe is to use the offset function, asking for the data to be copied and +2 empty columns next to each individual result.
So it should look like;
Trial 1a Trial 2a Trial 3a Trial1b Trial2b Trial3b
B2(A2data), C2(empty), D2(empty), E2(B2data), F2(empty), G2(empty)...etc

This would be the first button to enter trial 1 in the first of the 3 columns
The second button could have the same function but start from B3 (shifted one place to the right).
The third would follow suit but start in B4 (shifted two places to the right).
This is what it currently looks like which copies the data from one sheet to another, inserting to the next available row below, but doesn't include the offset.

Sub Oval3_Click()
Sheets("CMJInput").Select
Range("E7:L7").Select
Application.CutCopyMode = False
Selection.Copy
With Sheets("CMJDatabase")
lst = .Range("C" & Rows.Count).End(xlUp).Row + 1
.Range("C" & lst).PasteSpecial xlPasteColumnWidths
.Range("C" & lst).PasteSpecial xlPasteValues
End With
End Sub

Please help with the offset columns input scripting.
Thanks
Tom
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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