snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Hi dear
I have this 2 sheets where in the expected purchases sheet row2, I got the values with the help of formulas connected to the already existing 2 sheets. I need your expertise to convert the formulas into code and get the data in Purchases sheet. The code to create the purchases sheet with headings is working.
with the help of a code, insert formulas in each column as shown in the purchases sheet row2
resize the data in Purchases with 2B
The new created purchases sheet should match the expected result as shown without the formulas.
Thank you in advance.
Hi there,
Please skip above question,I asked for advice on VBA. Actions to do 1. Separate the data in the L line into Room# and the last name in the M and N lines. 2. Rearrange the sheet "Working" data in the Sheet"MOVECOLUMN" Result: Just press one system and you can do it To the above action question 1 How can I use vba to write the formulas of m and n lines, and then automatically run to the last line with data 2 How to change the formulas to the value in vba in the m and n lines
Last edited by sna on Sun Oct 09, 2022 3:56 pm, edited 1 time in total.
Sub SplitTextAndRearrangeCols()
Dim rall As Range, r As Range
Dim rw As Long
With Worksheets("working")
Set rall = .Range("l3", .Range("l" & .Rows.Count).End(xlUp))
rw = rall.Rows.Count
For Each r In rall
r.Offset(0, 1).Resize(1, 2).Value = VBA.Split(VBA.Replace(r.Value, "Rm", ""), "/")
Next r
With Worksheets("movecloumn")
.Range("a2").Resize(rw).Value = rall.Parent.Range("b3").Resize(rw).Value
.Range("b2").Resize(rw).Value = rall.Parent.Range("g3").Resize(rw).Value
.Range("d2").Resize(rw).Value = rall.Parent.Range("c3").Resize(rw).Value
.Range("e2").Resize(rw).Value = rall.Parent.Range("m3").Resize(rw).Value
.Range("g2").Resize(rw).Value = rall.Parent.Range("n3").Resize(rw).Value
End With
End With
End Sub