• 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.

VB Code to paste values in first empty cell

Ateeb Ali

Member
Dear Sir
Please find attached test file.

I am simply using this code to copy data from one cell to another
Code:
Sub Copy1()

    Range("G13").Select
    Selection.Copy
    Range("C13").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
End Sub
What I want that I have a date from G13:G23, if I press first button G23
its data should be copied from cell G23 and paste in first available empty cell between range C13:C23
Please help
 

Attachments

  • Copy Chandoo.xlsb
    28.3 KB · Views: 5
Dear Sir
File enclosed with first post, I have put buttons in Column I from Range I13: I23
Total eleven button on each cell, that means when user press button in I13, it will pick value form cell G13 and paste in C13
similarly it goes to bottom, for example, if user press button in cell I18, it will pick value from G18 and paste in C18
What I want that IF user press button in I18 and when C13:C17 are empty cell, it should be first copied from G18 to C13
If value exist in C13, it should paste in C14, like wise
 
You must paste this procedure to the Sheet3 (DC) worksheet module then allocate it to each 'Copy' button :​
Code:
Sub CopyG()
   Dim R&
       R = [B12].CurrentRegion.Columns(2).Find("*", , xlValues, , , xlPrevious)(2).Row
    If R < 24 And Not IsError(Application.Caller) Then Cells(R, 3).Value2 = Me.Shapes(Application.Caller).TopLeftCell(1, -1).Value2
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Ateeb Ali
You have there many more buttons
... some cells has more than one!
... ... why would You use those buttons at all?
Test this sample.
 

Attachments

  • Copy Chandoo.xlsb
    25.7 KB · Views: 6
Back
Top