:D snasui.com ยินดีต้อนรับ :D
ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย :thup: สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ :arrow: ระบุ Version ของ Excel
:!: โปรดทราบ :!:
  1. กรุณาอ่านกฎการใช้บอร์ด (Forum rules) ในตำแหน่งด้านบนของแต่ละบอร์ด
  2. การสมัครสมาชิก การ Login การกู้คืนรหัสผ่าน
    1. สมัครสมาชิกดูขั้นตอนได้ที่ :arrow: สมัครสมาชิก
    2. Login เข้าระบบโดยคลิกปุ่ม Login ตรงมุมขวาบนของหน้านี้ :roll:
    3. การ Login ผ่าน Facebook ดูวิธีที่ :arrow: Login ผ่าน Facebook
    4. ลืมรหัสผ่านสามารถรับรหัสใหม่ได้ที่ :arrow: Reset รหัสผ่าน
  3. มีปัญหาการใช้งาน แจ้งผู้ดูแลระบบได้ที่ :arrow: ติดต่อผู้ดูแลระบบ
  4. กำหนดการตั้งค่าส่วนตัว เช่นตั้งค่าภาษาเป็นไทยหรืออังกฤษดูได้ที่ :arrow: ตั้งค่าส่วนตัว
  5. การตั้งและตอบกระทู้ดูได้ที่ :arrow: วิธีการตั้งและตอบกระทู้
  6. การจัดรูปแบบตัวอักษรด้วย bbcode ในช่องแสดงความคิดเห็นดูได้ที่ :arrow: จัดรูปแบบตัวอักษร
  7. กำหนดขนาดตัวอักษรใน Browser ดูได้ที่ :arrow: กำหนดขนาดตัวอักษรใน Browser

extract code by column wise

Forum rules
  1. ไม่อนุญาตให้ใช้ภาษาแชทในการถามและตอบปัญหา ไม่ใช้คำว่า "คับ" หรือ "อ่ะครับ" แทนคำว่า "ครับ" ไม่ใช้คำว่า "เด๋ว" แทนคำว่า "เดี๋ยว" เป็นต้น เนื่องจากเมื่อแปลเป็นภาษาต่างประเทศแล้วจะให้ความหมายผิดไปจากที่ควรจะเป็น
  2. ห้ามถามโดยระบุชื่อผู้ตอบและต้องตั้งชื่อกระทู้ให้สื่อถึงปัญหาที่จะถาม ไม่ตั้งชื่อว่า ช่วยด้วยครับ, มีปัญหามาปรึกษาครับ เป็นต้น
  3. กรุณาอธิบายปัญหาและระบุคำตอบที่ต้องการมาในกระทู้ด้วยเสมอถึงแม้จะอธิบายไว้ในไฟล์แนบแล้วก็ตาม ทั้งนี้เพื่ออำนวยความสะดวกแก่เพื่อนสมาชิกในการค้นหาข้อมูล
  4. กรุณาแนบไฟล์ตัวอย่างพร้อมแสดงคำตอบที่ถูกต้องมาในไฟล์ด้วยเพื่อให้ง่ายต่อการทำความเข้าใจและสะดวกต่อการตอบคำถาม (ขนาดไฟล์ไม่เกิน 500Kb ขนาดภาพไม่เกิน 800*600 Pixel) ไม่แนบเป็น Link มาจากแหล่งอื่นที่อาจจะถูกลบทิ้งไปโดยต้นทางในภายหลัง นอกจากนี้ไม่ควรแนบไฟล์ที่มีข้อมูลสำคัญอันก่อให้เกิดความเสียหายกับตนเองและผู้อื่น
  5. กรณีเป็นคำถามเกี่ยวกับ Programming เช่น VBA, VB.Net, C#, SQL ฯลฯ ต้องลองเขียนมาเองก่อนเสมอ ถามเฉพาะที่ติดปัญหา ระบุ Module, Procedure ที่ติดปัญหาให้ชัดเจน กรุณาโพสต์ Code ให้แสดงเป็น Code คือเปิดด้วย [code] และปิดด้วย [/code] ตัวอย่างเช่น [code]dim r as range[/code] เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่าง)
  6. กรุณาแจ้งผลการใช้งานเมื่อได้รับคำตอบว่าตรงกับความต้องการหรือไม่

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :thup: :cp: :flw: :rz: :sg: :tt: :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :ard: :arl: :aru: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: extract code by column wise

Re: extract code by column wise

#8

by sna » Tue Jan 05, 2021 7:27 am

Thanks it worked flawlessly

Re: extract code by column wise

#7

by snasui » Mon Jan 04, 2021 10:51 pm

:D You can adjust code like this:

Code: Select all

'Other code
Dim i As Integer
Set rng = Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each Dn In rng
    Sp = Split(Dn.Value, ")")
    For i = LBound(Sp) To UBound(Sp) - 1
       Dn.Offset(0, i + 1).Value = Split(Sp(i), "(")(1)
    Next i
Next Dn
'Other code

Re: extract code by column wise

#6

by sna » Mon Jan 04, 2021 10:03 pm

Hi Dear

It works for the first part another no work like in the columns highlight yellow


Thanks
Attachments
ect code.xlsm
(17.68 KiB) Downloaded 3 times

Re: extract code by column wise

#5

by snasui » Sat Jan 02, 2021 9:52 pm

:D The example code is below:

Code: Select all

'Other code
Sp = Split(Dn.Value, ")")
If UBound(Sp) > 0 Then
  Dn.Offset(, 1).Value = Mid(Sp(0), 2)
  Dn.Offset(, 2).Value = Sp(1)
End If
'Other code

Re: extract code by column wise

#4

by sna » Sat Jan 02, 2021 9:37 pm

Thanks for your prompt response.
Here's an attachment


Thanks
Attachments
ect code.xlsm
(17.62 KiB) Downloaded 7 times

Re: extract code by column wise

#3

by snasui » Sat Jan 02, 2021 7:12 pm

:D Please attach file with code inside again for easy to be testing.

Re: extract code by column wise

#2

by sna » Sat Jan 02, 2021 11:27 am

Code: Select all

Sub Extract()
Dim Rng As Range,Dn As Range,Sp As Variant
Set Rng=Range("A2",Range("A"&Rows.Count).End(xlUp))
For Each Dn in Rng
Sp=Split(Dn.Value,"(")
If Ubound(Sp)>0 Then
Dn.offset(,1).Value=Left(Sp(1), Len(Sp(1)) - 1)
End if
Next 
End Sub

extract code by column wise

#1

by sna » Sat Jan 02, 2021 11:19 am

Hi Dear
I need to extract text within brackets to multiple column.
I have listed result starts from column AC.
But the actual result I would need in column B onward.

I add a code below but work only one column


Thanks
Attachments
Item Code.xlsx
(11.83 KiB) Downloaded 11 times

Top