- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 254
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-23
|
¦^´_ 6# jesscc - Sub SourceData_S()
- Dim Ay()
- With Worksheets("¸ê®Æ¨Ó·½")
- Set Rng = .Range("A3:B3")
- fs = False
- If .Range("B3").Value = "" Then
- MsgBox "µLªk¨ú±oªÑ²¼¦WºÙ,½Ð½T©wªÑ²¼¦WºÙ¤w¶ñ¤JB3Àx¦s®æ", 32, "¸ê®Æ¿ù»~!"
- Exit Sub
- End If
- For Each sh In Sheets 'Àˬd¤u§@ªí¦WºÙ¬O§_¦s¦b
- If sh.Name = .[B3].Text Then fs = True: Exit For
- Next
- If fs = False Then Sheets.Add.Name = .[B3].Text '¦pªG¤u§@ªí¤£¦s¦b´N·s¼W¤u§@ªí
- ar = Array("A", "C", "I", "P") '»Ýn´£¨úªºÄæ¦ì
- If fs = False Then '¦pªG¬O·s¼W¤u§@ªí¡A´N¦s¤J¼ÐÃD
- ReDim Preserve Ay(s) '±N¼ÐÃD¦C¦s¤J°}¦Cªº²Ä¤@µ§¨ÃÂX¤j°}¦C
- Ay(s) = Array(.Cells(4, ar(0)).Value, .Cells(4, ar(1)).Value, .Cells(4, ar(2)).Value, .Cells(4, ar(3)).Value, "¦¨¥æ¶q¥eªÑ¥»¤ñ¨Ò")
- s = s + 1
- End If
- For i = 5 To .Cells(.Rows.Count, 1).End(xlUp).Row '¶i¤J¸ê®Æ°j°é
- If Weekday(.Cells(i, ar(0)), vbMonday) < 5 Then '§PÂ_¤é´Á¬°¬P´Á´X¡A¬P´Á5¥H«e°õ¦æ
- ReDim Preserve Ay(s) '±N¸ê®Æ¦s¤J°}¦C
- Ay(s) = Array(.Cells(i, ar(0)).Text, .Cells(i, ar(1)).Value, .Cells(i, ar(2)).Value, .Cells(i, ar(3)).Value, "=RC[-2]*RC[-1]/R1C4")
- s = s + 1
- Else '¬P´Á¤°õ¦æ
- ReDim Preserve Ay(s) '±N¸ê®Æ¦s¤J°}¦C
- Ay(s) = Array(.Cells(i, ar(0)).Text, .Cells(i, ar(1)).Value, .Cells(i, ar(2)).Value, .Cells(i, ar(3)).Value, "=RC[-2]*RC[-1]/R1C4")
- s = s + 1
- ReDim Preserve Ay(s) 'Àx¦s¤@ӪťզC¨ì°}¦C
- Ay(s) = Array("", "", "", "", "")
- s = s + 1
- End If
- Next
- With Sheets(Sheets("¸ê®Æ¨Ó·½").[B3].Text)
- Rng.Copy .[a1] 'ªÑ²¼¦WºÙ
- .[C1] = "ªÑ¥»(±i)": .[D1].FormulaLocal = "=YES|DQ!'" & .[a1] & ".Capital'*1000"
- With .Range(.[A3], .Cells(.Rows.Count, 6))
- '.ClearContents '²M°£ì¨Ó¸ê®Æ
- .Columns(1).NumberFormat = "yyyy/mm/dd" '³]©wAÄ欰¤é´Á®æ¦¡
- End With
- .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(s, 5) = Application.Transpose(Application.Transpose(Ay)) '±N°}¦Cȼg¤J¤u§@ªí
- .Columns("A:E").AutoFit 'A:EÄæ¦Û°ÊÄæ¼e
- End With
- End With
- End Sub
½Æ»s¥N½X |
|