snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Function showmonthmps()
Dim i As Integer, x As Integer
Dim month() As String
Dim no_d As Single, sum As Single, total As Single
i = 1
no_d = 0
Do Until Worksheets("MONTH").Cells(i + 1, 1).Value = ""
i = i + 1
no_d = no_d + 1
Loop
ReDim month(1 To no_d)
i = 1
For i = 1 To no_d ' collection with array sheet : MPS COMPARE
month(i) = Worksheets("MONTH").Cells(1 + i, 1).Value
Next i
i = 1
For i = 1 To no_d
If Worksheets("MPS COMPARE").Cells(6, 2 + i).Value = "" Then
'MPS1
Worksheets("MPS COMPARE").Cells(6, 2 + i).NumberFormat = "@"
Worksheets("MPS COMPARE").Cells(6, 2 + i).Value = Worksheets("MONTH").Cells(1 + i, 1).Value
[color=#FF0000]Columns("D:D").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
'end frist month show commit
Call comparefmonth1mps1[/color]End If
Next i
End Function
You do not have the required permissions to view the files attached to this post.
Last edited by hutthaya on Thu Jan 16, 2014 2:01 pm, edited 1 time in total.
Public Sub showmonthmps()
Dim i As Integer, x As Integer
Dim month() As String
Dim no_d As Single, sum As Single, total As Single
i = 1
no_d = 0
Do Until Worksheets("MONTH").Cells(i + 1, 1).Value = ""
i = i + 1
no_d = no_d + 1
Loop
ReDim month(1 To no_d)
i = 1
For i = 1 To no_d ' collection with array sheet : MPS COMPARE
month(i) = Worksheets("MONTH").Cells(1 + i, 1).Value
Next i
i = 1
For i = 1 To no_d
If Worksheets("MPS COMPARE").Cells(6, 2 + i).Value = "" Then
'MPS1
Worksheets("MPS COMPARE").Cells(6, 2 + i).NumberFormat = "@"
Worksheets("MPS COMPARE").Cells(6, 2 + i).Value = Worksheets("MONTH").Cells(1 + i, 1).Value
Columns("D:D").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
'end frist month show commit
Call comparefmonth1mps1
End If
Next i
End Sub
You do not have the required permissions to view the files attached to this post.
Sub test()
Dim rAll As Range
Dim i As Integer
With Sheets("MPS COMPARE")
Set rAll = .Range("c6", .Cells(6, Columns.Count).End(xlToLeft))
End With
For i = rAll.Count To 2 Step -1
rAll(i).EntireColumn.Insert
Next i
End Sub
Public Sub compare11()
Call insertcolumns ' จะทำการแทรกคอลัมน์ก่อน
Call compareprocap 'จะแสดงชื่อโปรดัคและคาปาซิตี้
Call comparefmonth1mps1 ' แสดงค่าซัมของเดือนแรก
End Sub
You do not have the required permissions to view the files attached to this post.