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

copy data by loop

delta

Member
TextBox 1 = 12/7/2005
TextBox 2 = 12/7/2015
means difference between to two TextBox is 11 years
i like data copy by loop in sheet 1 look like i attache image


▬▬▬▬▬▬▬▬▬ Mod edit : thread moved to appropriate forum !
 

Attachments

  • Capture.JPG
    Capture.JPG
    21.1 KB · Views: 15
Give us bit more detail. Is TextBox in worksheet or in UserForm?

If in UserForm. Something like...

Code:
Private Sub CommandButton1_Click()
Dim sDate As Date, eDate As Date
With Me
    sDate = CDate(.TextBox1.Value)
    eDate = CDate(.TextBox2.Value)
End With

With Sheet1.Range("A2:A" & (Year(eDate) - Year(sDate) + 2))
    .Formula = "=" & Year(sDate) & "+Row(A1)-1"
    .Value = .Value
End With
End Sub
 
Back
Top