¼ÐÃD:
[µo°Ý]
§Ú·Q¼g¨CÓ¾÷ºØùØ¿ï¥X ©ÒÄݮƸ¹¤¤³Ì¤p¹ê»Ú¶i®Æªº¼Æ¦r
[¥´¦L¥»¶]
§@ªÌ:
scjiao
®É¶¡:
2014-6-21 23:39
¼ÐÃD:
§Ú·Q¼g¨CÓ¾÷ºØùØ¿ï¥X ©ÒÄݮƸ¹¤¤³Ì¤p¹ê»Ú¶i®Æªº¼Æ¦r
½Ð°Ý¤j¤jÌ¡A¦pÀɮסA§Ú·Q¼g¨CÓ¾÷ºØùØ¿ï¥X ©ÒÄݮƸ¹¤¤(´Áªì®w¦s+¹ê»Ú¶i®Æ)³Ì¤pªº¼Æ¦r¡A¸Ó¦p¦ó¼gVBAµ{¦¡½X??¡AÁÂÁÂ
½Ð¤j¤j¦^ÂЮɶKµ{¦¡½X
[attach]18526[/attach]
§@ªÌ:
GBKEE
®É¶¡:
2014-6-22 09:55
¦^´_
1#
scjiao
¸Õ¸Õ¬Ý
Option Explicit
Sub EX()
Dim Rng(1 To 2) As Range, E As Range
Dim AR(), i As Integer
With Sheets("Sheet1")
Set Rng(1) = .Range("A6", .Range("A" & .Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants)
'Ū¨ú¾÷Á`ªº½d³ò¦³¤å¦rªºÀx¦s»Õ
End With
ReDim AR(0 To Rng(1).Areas.Count, 1 To 4)
AR(0, 1) = "¾÷Á`"
AR(0, 2) = "®Æ¸¹"
AR(0, 3) = "´Áªì®w¦s"
AR(0, 4) = "¹ê»Ú¶i®Æ"
For i = 1 To Rng(1).Areas.Count
AR(i, 1) = Rng(1).Areas(i).Cells(1)
Set Rng(2) = Rng(1).Areas(i).Resize(, 2).Columns(2).SpecialCells(xlCellTypeConstants)
'¾÷Á`ªº½d³ò [²Ä2Äæ] ¦³¤å¦rªºÀx¦s»Õ
For Each E In Rng(2).Areas
If E.Range("b1") + E.Range("E5") < AR(i, 3) + AR(i, 4) Then
'"´Áªì®w¦s"+"¹ê»Ú¶i®Æ"
AR(i, 2) = E.Cells(1)
AR(i, 3) = E.Range("b1") '¥HE.Cells(1)
AR(i, 4) = E.Range("E5")
ElseIf AR(i, 2) = "" Then '®Æ¸¹: °}¦C¤¸¯À=""
AR(i, 1) = Rng(1).Areas(i).Cells(1)
AR(i, 2) = E.Cells(1)
AR(i, 3) = E.Range("b1")
AR(i, 4) = E.Range("E5")
End If
Next
Next
Sheets("Sheet2").[A1].Resize(UBound(AR), UBound(AR, 2)) = AR 'Åã¥Ü
End Sub
½Æ»s¥N½X
§@ªÌ:
scjiao
®É¶¡:
2014-6-22 11:36
¦^´_
2#
GBKEE
ÁÂÁª©¥Dªº¼ö¤ß¦^µª¡A«D±`·PÁÂ~:)
§@ªÌ:
scjiao
®É¶¡:
2014-6-22 21:49
¦^´_
2#
GBKEE
½Ð°Ýª©¥D¤j¤j
For Each E In Rng(2).Areas
next
Rng(2).Areas ¬O¤°»ò·N«ä§r?
E.range("b1")¤S¬O¤°»ò·N«ä§r?
¤£¦n·N«ä¡Aªì¾ÇªÌ
§@ªÌ:
GBKEE
®É¶¡:
2014-6-23 06:44
¦^´_
4#
scjiao
Option Explicit
Sub Ex()
Dim Rng As Range, i As Integer
Application.VBE.MainWindow.Visible = True
Application.VBE.Windows("§Y®É¹Bºâ").Visible = True
Set Rng = Range("A1:C1,A5:C5,A3:B4,A10:A15")
'Areas ÄÝ©Ê ¶Ç¦^ Areas ¶°¦X¡A¦¹¶°¦X¥Nªí¦h«½d³ò¤¤ªº©Ò¦³½d³ò¡C°ßŪ¡C
For i = 1 To Rng.Areas.Count '¦h«½d³òªºÓ¼Æ
Stop '«öF8°õ¦æ¤U¤@¨B
Debug.Print vbLf & Rng.Areas(i).Address
'¥H Areas(i)¬°°ò·Çªº Range ª«¥ó¡A¸Óª«¥ó¥Nªí¤@ÓÀx¦s®æ©ÎÀx¦s®æ½d³ò¡C
Debug.Print Rng.Areas(i).Range("A1").Address
Debug.Print Rng.Areas(i).Range("B1").Address
Debug.Print Rng.Areas(i).Range("C1").Address
Next
End Sub
½Æ»s¥N½X
§@ªÌ:
scjiao
®É¶¡:
2014-6-23 07:41
¦^´_
5#
GBKEE
«D±`·PÁª©¥Dªº¦^ÂСA¨º½Ð°Ý
For Each E In Rng(2).Areas
next
¨ä¤¤
E.range("b1")¬O¤°»ò·N«ä
ÁÂÁª©¤j
§@ªÌ:
GBKEE
®É¶¡:
2014-6-23 09:10
¦^´_
6#
scjiao
¥H E ¬°°ò·Çªº Range ª«¥ó¡A¸Óª«¥ó¥Nªí¤@ÓÀx¦s®æ©ÎÀx¦s®æ½d³ò
»P 5# ªºµ{¦¡½X¹B¦æµ²ªG£¸¼Ë
Option Explicit
Sub Ex()
Dim Rng As Range, E As Range
Application.VBE.MainWindow.Visible = True
Application.VBE.Windows("§Y®É¹Bºâ").Visible = True
Set Rng = Range("A1:C1,A5:C5,A3:B4,A10:A15")
'Areas ÄÝ©Ê ¶Ç¦^ Areas ¶°¦X¡A¦¹¶°¦X¥Nªí¦h«½d³ò¤¤ªº©Ò¦³½d³ò¡C°ßŪ¡C
For Each E In Rng.Areas '¦h«½d³òªºÓ¼Æ
Stop '«öF8°õ¦æ¤U¤@¨B
Debug.Print vbLf & E.Address
'¥H E ¬°°ò·Çªº Range ª«¥ó¡A¸Óª«¥ó¥Nªí¤@ÓÀx¦s®æ©ÎÀx¦s®æ½d³ò¡C
Debug.Print E.Range("A1").Address
Debug.Print E.Range("B1").Address
Debug.Print E.Range("C1").Address
Next
End Sub
½Æ»s¥N½X
[attach]18540[/attach]
§@ªÌ:
scjiao
®É¶¡:
2014-6-23 23:29
¦^´_
7#
GBKEE
ÁÂÁª©¤j¡A§Ú§¹¥þ¤F¸Ñ¤F¡A³Ì«á§Ú·Q°Ýªº¬O¨ä¤¤¤@¬qµ{¦¡½X
With Sheets("Sheet1")
Set Rng(1) = .Range("A6",
.Range("A" & .Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants)
'Ū¨ú¾÷Á`ªº½d³ò¦³¤å¦rªºÀx¦s»Õ
End With
¨ä¤¤
.Range("A" & .Rows.Count).End(xlUp)).SpecialCells(xlCellTypeConstants)
¦¹specialcells(xlcellTypeConstants) °Ñ¼Æ¬O¥Nªí¤°»ò·N«ä
§@ªÌ:
GBKEE
®É¶¡:
2014-6-24 08:44
¦^´_
8#
scjiao
¨ì VBAµøµ¡ »¡©ú ¿é¤J
SpecialCells
¬Ý¬Ý
ºÉ¶q¨ì »¡©ú ¤¤¿é¤J ºÃ°ÝªºÄÝ©Ê.¤èªk.¨ç¼Æ.·|¦h¤F¸ÑVBAªº
§@ªÌ:
scjiao
®É¶¡:
2014-6-24 23:15
¦^´_
9#
GBKEE
¶â¡AÁÂÁª©¥D
Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)