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

Range Set By Vba

delta

Member
in this code check last blank row in sheet1 in Columun "A") than TextBox Value transfer in sheet1 last blank row in "C" column. in this macro run the value transfer from Range "C6" but i like TextBox value Transfer from Range "C2". Range " C1" is heading



Code:
Dim j As Long

Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Dim ctrl As Control
  
  
  For j = 6 To 10
  Cells(Lastrow, "C").Value = Me.Controls("TextBox" & j).Value

  Lastrow = Lastrow + 1
  Next
 
Last edited by a moderator:
It is not very clear exactly what you are trying to achieve

Can you post a sample file with an example before and after ?
 
i upload image and sample file in this image i wish to current provision amount is start from "C2" columun
 

Attachments

  • Capture.JPG
    Capture.JPG
    80 KB · Views: 4
  • R_Plaaning - Copy.xlsm
    26.5 KB · Views: 4
Try this

Code:
Sub test()

Application.ScreenUpdating = False

Dim i As Long
Dim Lastrow As Long

Lastrow = Cells(Rows.Count, "B").End(xlUp).Row

For i = 1 To 5
  Cells(Lastrow + i, "B").Value = Me.Controls("TextBox" & i).Value
  Cells(Lastrow + i, "C").Value = Me.Controls("TextBox" & CStr(5 + i)).Value
  Me.Controls("TextBox" & i).Value = ""
  Me.Controls("TextBox" & CStr(5 + i)).Value = ""
Next
Application.ScreenUpdating = True

End Sub
 
Cstr() converts the contents to Strings
So they can be appended to the preening term
 
Back
Top