snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Private Sub TextBox1_AfterUpdate()
If Me.TextBox1.Value <> "" Then
Dim irow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet2")
Me.TextBox1.Text = Application.Trim(Me.TextBox1.Text)
'Find first empty row in database
irow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
'Copy The Data To The Database
ws.Cells(irow, 1).Value = Me.TextBox1.Value
ws.Cells(irow, 1).Select
Me.TextBox1 = ""
Me.TextBox1.SetFocus
Else
MsgBox "no product", vbCritical
End If
End Sub
You do not have the required permissions to view the files attached to this post.
Option Explicit
Sub RoundedRectangle1_Click()
Dim s As Range
Dim tg As Range
Dim tg3 As Range
Set s = Worksheets("Sheet1").Range("B1")
Set tg = Worksheets("Sheet2").Range("A365").End(xlUp).Offset(1, 0)
Set tg3 = Worksheets("Sheet3").Range("A365").End(xlUp).Offset(1, 0)
s.Copy
tg.PasteSpecial xlPasteValues
tg3.PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub
You do not have the required permissions to view the files attached to this post.
Option Explicit
Sub RoundedRectangle1_Click()
Dim s As Range
Dim tg As Range
'Dim tg3 As Range
Set s = Worksheets("Sheet1").Range("B1:C7")
Set tg = Worksheets("Sheet2").Cells(1, Cells.Columns.Count).End(xlToLeft).Offset(0, 1)
'Set tg3 = Worksheets("Sheet3").Range("A1").End(xlToLeft).Offset(0, 1)
s.Copy
tg.PasteSpecial xlPasteValues
'tg3.PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub