Need advice copying from one sheet to another

mrmobile

New Member
Joined
Dec 24, 2018
Messages
3
I want to have data from one worksheet copied and moved to another worksheet.
I want to have a button to do this action.
Can someone give me guidance on where I should start?


I want to have one sheet where I have data formatted and colored according to different conditions I set.


I want to have a way of adding new data - some of this data might already be present, if present, I don't want it included.


I thought I could have my formatted data in one sheet and then put new unformatted (and possibly duplicated) data in another sheet.
I could then have a button that when pressed would copy from the unformatted to the formatted (which then gets formatted because of the rules I have setup.)


- Process unformatted data row by row.
- Check to see if row value in column X already exists in man worksheet.
- If exists, move onto next row.
- If doesn't exist, insert into bottom row.


I want to make more advance and add other conditions... but the above would give me a great start.


Not sure where to start.
Any help would be great.


I haven't done VBA programming.

EDIT: I just thought... instead of having a separate sheet, I could maybe just import a CSV?


Thanks.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I may not be able to do much today ( Xmas day), but you will need to provide Sheet names, data ranges for both sheets.
You stated in your post
Code:
copied and moved to another worksheet
Which is it ?? Copied OR moved ??
 
Upvote 0
Which is it ?? Copied OR moved ??
Moved definitely.

Names of worksheets:
Sales
Raw Data

Columns:
Unique Reference
Price
Date
Customer first name
Customer surname name

Actually... one thing I should add...
In the main sheet 'Sales', I will have other columns that I will add.
So when the data is moved, it would be safest to copy (I mean move) by matching columns first - as opposed to just simply copying/moving rows - I still need the new columns.

Data ranges to be copied from 'Raw Data' all rows with data, apart from ignoring first row.
(I need this ignoring part be in the code somewhere where I can change, I might need to change to first 2 or 3 rows.)

Hope that makes sense.

Happy to wait ?

Have a wonderful Xmas ? ?
 
Upvote 0
Don't the columns on Raw Data match the existing columns on Sales ?
Is the formatting on Sales done by CF or manually ?
 
Upvote 0
Don't the columns on Raw Data match the existing columns on Sales ?
Is the formatting on Sales done by CF or manually ?
CF? what's what? the formatting is done by if and data validation formulas in excel.

raw data does have matching columns
but at the end or at the beginning, i would like to add new columns add add things like checkboxes or something
so... ideally, i would like the data copied by matching columns names.
does it make the work that much harder?
 
Upvote 0
CF is Conditional Formatting, cells / rows are usually colored or formatted by the value in the cell or a formula to specify the criteria.
Any macro code created will usually overwrite / remove any existing Conditional Foirmatting.
 
Upvote 0
This is only a start and will copy rows from raw data to Sales....but I am concerned that the "matching" columns aren't in the same order on each sheet.
So, you may need to provide the column order for both sheets

Code:
Sub MM1()
Dim lr As Long, lr2 As Long, ws As Worksheet, ws2 As Worksheet
Set ws2 = Sheets("Raw Data")
Set ws = Sheets("Sales")
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
lr2 = ws2.Cells(Rows.Count, "A").End(xlUp).Row
With ws2
    .Range("A2:E" & lr2).EntireRow.Copy ws.Range("A" & lr + 1)
    .UsedRange.ClearContents
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,596
Messages
6,125,726
Members
449,255
Latest member
whatdoido

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