snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub Preview()
'Define abbreviations for worksheets
Dim WI As Worksheet
Dim WF As Worksheet
Set WI = Worksheets("Input")
Set WF = Worksheets("Forms")
'Detailed Question
Dim AmountCell1 As Range
Dim HeadingRow1 As Integer
Dim CurrentRow1 As Integer
HeadingRow1 = WF.Range("FormsFirstLine1").Row
CurrentRow1 = HeadingRow1
For Each AmountCell1 In WI.Range("Question").Cells
If AmountCell1 <> "" Then
WF.Cells(HeadingRow1, 6) = ""
CurrentRow1 = CurrentRow1 + 1
WF.Cells(CurrentRow1, 2) = AmountCell1.Text
CurrentRow1 = CurrentRow1 + 20
End If
Next
End Sub
You do not have the required permissions to view the files attached to this post.
Sub Preview()
'Define abbreviations for worksheets
Dim WI As Worksheet
Dim WF As Worksheet
Set WI = Worksheets("Input")
Set ws4 = Worksheets("Forms")
ws4.Range("A12").Resize(1000, 1).EntireRow.Delete
ws4.Range("B11:AC1000").ClearContents
'Sheet input
With Sheets("input")
Set rDataAll = .Range("B2:B5", .Range("B" & Rows.Count).End(xlUp))
End With
i = 12
For Each r In rDataAll
If r = rFind Then
ws4.Range("b" & i).Resize(1, 2).Value = _
r.Offset(0, 1).Resize(1, 2).Value
ws4.Range("d" & i).Resize(1, 2).Font.Name = "Arial Unicode MS"
ws4.Range("d" & i).Resize(1, 2).Font.Size = 12
i = i + 1
End If
Next r
With ws4.Range(ws4.Cells(CurrentRow1 - 20, 2), ws4.Cells(CurrentRow1 - 1, 1)).Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
With ws4.Range(ws4.Cells(CurrentRow1 - 20, 2), ws4.Cells(CurrentRow1 - 1, 30)).Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlMedium
End With
End Sub
You do not have the required permissions to view the files attached to this post.