Plz see the sample file
if there is data in sheet3 then see yellow colour highlighted data in sheet5
if there is data in sheet4 then see blue colour highlighted data in sheet5
Conditionally Copy and paste of the data between sheets
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Conditionally Copy and paste of the data between sheets
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Conditionally Copy and paste of the data between sheets
I'm sorry, it is not clear to me what you want to accomplish.
Best wishes,
Hans
Hans
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Re: Conditionally Copy and paste of the data between sheets
Sorry HansV Sir now i have mentioned everything plz look into it
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Conditionally Copy and paste of the data between sheets
What do you mean by "if sheet3 has the data then copy sheet6 1st and 3rd row and paste to sheet5"? What is "the data"?
Best wishes,
Hans
Hans
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Re: Conditionally Copy and paste of the data between sheets
see this file, see all the sheets
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Conditionally Copy and paste of the data between sheets
I give up. I hope that someone else understands what you want. Sorry!
Best wishes,
Hans
Hans
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Re: Conditionally Copy and paste of the data between sheets
No problem Sir Thnx for giving ur precious time and great support to this post
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Re: Conditionally Copy and paste of the data between sheets
HansV Sir plz look this file and if u are able to solve it then fine and if not then no issue
i have divided the process into two parts for simple and understandable process this is first part
i have divided the process into two parts for simple and understandable process this is first part
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78788
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Conditionally Copy and paste of the data between sheets
Does this do what you want?
Code: Select all
Sub CopyData()
Dim w1 As Worksheet
Dim w2 As Worksheet
Dim w3 As Worksheet
Dim r1 As Long
Dim r3 As Long
Dim m As Long
Application.ScreenUpdating = False
Set w1 = Worksheets("Sheet5")
Set w2 = Worksheets("Sheet6")
Set w3 = Worksheets("Sheet3")
m = w3.Range("A" & w3.Rows.Count).End(xlUp).Row
For r3 = 2 To m
r1 = r1 + 1
w2.Range("A1").EntireRow.Copy Destination:=w1.Range("A" & r1)
w1.Range("C" & r1).Value = w3.Range("B" & r3).Value
r1 = r1 + 1
w2.Range("A3").EntireRow.Copy Destination:=w1.Range("A" & r1)
w1.Range("C" & r1).Value = w3.Range("B" & r3).Value
Next r3
Set w3 = Worksheets("Sheet4")
m = w3.Range("A" & w3.Rows.Count).End(xlUp).Row
For r3 = 2 To m
r1 = r1 + 1
w2.Range("A2").EntireRow.Copy Destination:=w1.Range("A" & r1)
w1.Range("C" & r1).Value = w3.Range("B" & r3).Value
r1 = r1 + 1
w2.Range("A4").EntireRow.Copy Destination:=w1.Range("A" & r1)
w1.Range("C" & r1).Value = w3.Range("B" & r3).Value
Next r3
Application.ScreenUpdating = True
End Sub
Best wishes,
Hans
Hans
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Re: Conditionally Copy and paste of the data between sheets
U r Right HansV Sir
Thnx for giving ur precious time and great support to this post
Problem Solved
Thnx for giving ur precious time and great support to this post
Problem Solved