ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   user form to copy and paste from source to destination (https://www.excelbanter.com/excel-programming/309714-user-form-copy-paste-source-destination.html)

rbekka33

user form to copy and paste from source to destination
 
I have 2workbooks - a source data workbook and a destination dat
modelling workbook. Every month I need to copy select columns from on
workbook to the other - the complication is that they are laid ou
differently eg column A (source) needs to be pasted over the older dat
of column J (destination).

Most of the time the copy and paste format doesn't change so i woul
like to have defaults set but have the option to change where to past
to, if the source changes as I have no control over that workbook.

I would also like to do this in one step if the default is true.

Can I have a user form which allows me to select the source columns an
paste into the destination columns through check boxes or drop dow
lists and if so, how would i do this

--
Message posted from http://www.ExcelForum.com


Andoni[_45_]

user form to copy and paste from source to destination
 
as a first step use:


Sub Trythis()

Dim UserRange As Range
Dim UserDestination As Range

On Error Resume Next
Set UserRange = Application.InputBox _
(Prompt:="Select you source data Range", _
Title:="Listen to me:", _
Default:=Selection.Address, _
Type:=8)

On Error GoTo 0
If UserRange Is Nothing Then
MsgBox "Bay Bay!"
End
End If
Set UserDestination = Application.InputBox _
(Prompt:="Select you Destination data Range", _
Title:="Listen to me:", _
Default:=Selection.Cells(1).Address, _
Type:=8)

If UserDestination Is Nothing Then
MsgBox "Bay Bay!"
End
End If

UserRange.Copy UserDestination
End Su

--
Message posted from http://www.ExcelForum.com


rbekka33[_2_]

user form to copy and paste from source to destination
 
Thanks for this except i think i may need some more instructions on ho
to incorporate the code.

When I create the User form - what do you suggest? Is this meant t
work with check boxes and drop downs?

I am imagining a user form which goes to the source sheet and allow
you to select one of the columns, and then allows you to select th
paste column from the destination.

thank

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com