snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Hi Dear!
Hopefully You're all doing fine.I need to transfer data from textbox to merge cells.the cells not having merge but when I run code cell itself should merge with value from Textbox1.
I create a code but when click button nothing happened
Dim BottomA As Long,i As Long
With Sheets("Sheet1")
BottomA=.Range("a"&Rows.Count).End(xlUp).Row
For i=2 To BottomA Step 2
.Range("a"&i &":a"&i+1).Merge
.Range("a"&i).MergeArea.Value=Me.TextBox1.Value
Next
End with
I wait for your kind response
Thank you in advance
You do not have the required permissions to view the files attached to this post.
With Sheets("KONTRAK")
bottomA = .Range("A" & Rows.Count).End(xlUp).Row + 2
If .Range("a2").Value = "" Then
.Range("a2:a3").Merge
.Range("a2").Value = Me.TextBox1.Text
Else
For i = 2 To bottomA Step 2
.Range("a" & i & ":a" & i + 1).Merge
.Range("a" & bottomA).Value = Me.TextBox1.Text
Next i
End If
Me.TextBox1.Text = ""
End With
Sub test()
With Sheets ("Sheet1")
Dim BottomA As Long,i As Long
BottomA=.Range("a"&Rows.Count).End(xlUp).Row
n=BottomA
. Range ("a"&i+2 & ":a"&i+3).Merge
. Range ("a"&i+2).MergeArea.Value=Me.TextBox1.Text
End With
Sub test()
With Sheets ("Sheet1")
Dim BottomA As Long,i As Long
BottomA=.Range("a"&Rows.Count).End(xlUp).Row
i=BottomA
. Range ("a"&i+2 & ":a"&i+3).Merge
. Range ("a"&i+2).MergeArea.Value=Me.TextBox1.Text
End With