Copies data from one sheet to another sheet but skips one column of data

Kenor

Board Regular
Joined
Dec 8, 2020
Messages
116
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone!

Actually I already use below formula to copies data from another sheet to another sheet.
That is, by clicking one bevel button, then all the selected data will be pasted to another sheet.

Sub Bevel2_Click()

Dim wsRegister_IN As Worksheet
Dim wsDatabase As Worksheet
Dim CopyLastRow As Long
Dim DestLastRow As Long

Set wsRegister_IN = Worksheets("Register IN")
Set wsDatabase = Worksheets("Database")

CopyLastRow = wsRegister_IN.Range("A" & wsRegister_IN.Rows.Count).End(xlUp).Row + 1
DestLastRow = wsDatabase.Range("A" & wsDatabase.Rows.Count).End(xlUp).Row + 1

wsRegister_IN.Range("A3", "J" & CopyLastRow).Copy Destination:=wsDatabase.Range("A" & DestLastRow)
Application.CutCopyMode = False

End Sub


But because in another sheet already create a formula in one column between copies of the data.
Then how can I modify the VBA program above to skip that column when pasted to another sheet.


Thank you.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Judging by the lack of responses, I am guessing that you should be specific about which column you want to skip copying to wsDatabase.
 
Upvote 0
My guess is you might need this
wsRegister_IN.Range("A3:J" & CopyLastRow).
 
Upvote 0
Judging by the lack of responses, I am guessing that you should be specific about which column you want to skip copying to wsDatabase.
Sorry, my question is a bit incomplete.

Actually, from the data ("A3", "J" & CopyLastRow) in the Register_IN sheet,
I want to skip the data for column F from being copied into the Database sheet.

How I can modified it?


Thanks
 
Upvote 0
How about
VBA Code:
wsRegister_IN.Range("A3:E" & CopyLastRow).Copy Destination:=wsDatabase.Range("A" & DestLastRow)
wsRegister_IN.Range("G3:J" & CopyLastRow).Copy Destination:=wsDatabase.Range("G" & DestLastRow)
 
Upvote 0
Solution
How about
VBA Code:
wsRegister_IN.Range("A3:E" & CopyLastRow).Copy Destination:=wsDatabase.Range("A" & DestLastRow)
wsRegister_IN.Range("G3:J" & CopyLastRow).Copy Destination:=wsDatabase.Range("G" & DestLastRow)
Thanks a lot for your help!

It's works..!
 
Upvote 0
Glad we could help & thanks for he feedback.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,189
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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