• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to create Macro to copy and paste cell's value.

doit

New Member
This for the Banana ripening rooms where we keep tracking of the ripening progress for 5 to 6 days until it gets ripe. So, currently we the user enters data in to the Row 1- Today Row which is link to another report and copy and paste manually to respectively date for the day.

So,I would like to create a macro to copy and paste value from one Row to another row based on today's days value.
for instance, in this attached file i have created macro which copy and paste cell's value as the specify the range but i would like to copy and paste value for the based on today's day.

So, when use click on the macro button, the data will be copy from the Row 1 (from C12 to K12) to the row reference to date volume to that day's date.

I would be highly appreciated if any one can help me.

Thank you
 

Attachments

Marc L

Excel Ninja
According to your attachment as a beginner starter :​
Code:
Private Sub CopyData_Click()
    Dim Rg As Range
    Set Rg = Me.UsedRange.Columns(2).Find(Application.Text(Date, [B12].NumberFormat), [B13], xlValues)
     If Rg Is Nothing Then Beep Else Rg(1, 2).Resize(, 9).Value2 = [C12:K12].Value2: Set Rg = Nothing
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 

doit

New Member
Hi Marc,
Much appreciated for your response.
However, I have tried it but somehow is not copying data unless i am something wrong.
I have a copy and paste your code into the command button VBA window.
can you please show me the step. i am not good at with VBA.
 
Last edited by a moderator:

doit

New Member
Hi Marc,
Need one more favor, is there any way we can copy data from 2 rows and paste it to respectively date reference.
I don't know how to explain in the words but if you see the attached file it is the same way as you did for single room, what if like if have double room like A and B. So, i would like to copy data for the A and B from the today to the respectively date cell for the A & B.

Please see the attached file herewith from which you will understand well.

Thanking you so much in advance.
 

Attachments

doit

New Member
Hi Marc,
somehow, I have figured out and its working now. Please check the below code and let me know if there is something to make the change.
I would like to put an alert msg box if today's is not found.

Once again thanks for your help.
Code:
Dim Rg As Range
    Set Rg = Me.UsedRange.Columns(2).Find(Application.Text(Date, [B12].NumberFormat), [B14], xlValues)
     If Rg Is Nothing Then Beep Else Rg(1, 2).Resize(, 13).Value2 = [C12:M13].Value2: Set Rg = Nothing
     Set Rg = Me.UsedRange.Columns(2).Find(Application.Text(Date, [B13].NumberFormat), [B14], xlValues)
     If Rg Is Nothing Then Beep Else Rg(2, 2).Resize(, 13).Value2 = [C13:M13].Value2: Set Rg = Nothing
End Sub
 
Last edited by a moderator:

Marc L

Excel Ninja
For some reason I have an issue with your last attachment …​
But according to your code, if you just have read the Resize VBA inner help :​
Code:
Private Sub CopyData_Click()
    Dim Rg As Range
    Set Rg = Me.UsedRange.Columns(2).Find(Application.Text(Date, [B12].NumberFormat), [B14], xlValues)
     If Rg Is Nothing Then Beep Else Rg(1, 2).Resize(2, 13).Value2 = [C12:M13].Value2: Set Rg = Nothing
End Sub
You may Like it !
 

doit

New Member
Hi Marc,

How are you sir?

I need your help again.
Much appreciated if you can assist me again.

Now, i am in to Avocado ripening and litte bit challainging for me to deal with temps and pressure so need to get more data, So i need to creat button which can run macro to copay data from Today- line (in blue color) to line below based on date respectively 3 times a day.

or is there any otherway you can think about that would also be acceptable. (The timeing are not important but like morning, afternoon, or evening as we are recoding 3 times a day.. so,if you want to eliminate that options would be also fine. ( in that case i will delete the coloumn)

It would be great favor to me if you can help me.

I am attaching the working for herewith.

Thank you,
 

Attachments

doit

New Member
Here is the latest file udapte
I am able do little bit but don't know how to apply logic if there is data for morning, so how to tell to go next line in after based on slection
 

Attachments

doit

New Member
Hello Team,
As info, i have post the same quesiton to ther forum as well and the link as below.
My applogies as i did not read the rules throughly.

 

Marc L

Excel Ninja
Thanks to let this forum know …​
According to your post #10 can you elaborate with details what are you expecting for ?​
 

doit

New Member
Well, Thank you so much for helping here.

What i want as you can see in the attached report, when you click on Copy Today's Data buttion, it should copy data from the Cell b16 to W16 to the respectively date (current date).

So we need to this process 3 times a day. (Morning, afternoon and Evening) for which user can slect list from Cell B16 as per the time there are checking temps and pressure.

I hope this will help you to undestand my question.

Thank you,
Much appreicated.
 

Attachments

Top