Public b As String, c As String
Sub song()
ActiveSheet.[a1].CurrentRegion.Select
With Selection
If Not .Find(b) Is Nothing Then
.Find(b).Activate
c = c & Chr(10) & Cells(ActiveCell.Row, 1).Value & """" & Cells(ActiveCell.Row, 2).Value & """" & Cells(ActiveCell.Row, 11).Value & """" & Cells(ActiveCell.Row, 6).Value & """" & Cells(ActiveCell.Row, 20).Value
End If
If Application.CountIf(ActiveSheet.[a1].CurrentRegion, b) > 1 Then
For i = 1 To Application.CountIf(ActiveSheet.[a1].CurrentRegion, b) - 1
.FindNext(ActiveCell).Activate
c = c & Chr(10) & Cells(ActiveCell.Row, 1).Value & """" & Cells(ActiveCell.Row, 2).Value & """" & Cells(ActiveCell.Row, 11).Value & """" & Cells(ActiveCell.Row, 6).Value & """" & Cells(ActiveCell.Row, 20).Value
Next i
End If
End With
End Sub
Sub 蓝月亮破损单号提取明细()
Dim c As String, xx As Workbook
Worksheets(1).Activate
arr = Range(Cells(4, 8), Cells(Cells(4, 8).End(xlDown).Row, 8))
Worksheets(2).Activate
For y = 1 To UBound(arr, 1)
b = arr(y, 1)
If y = 1 Then
Call song
Else: If y > 1 And arr(y, 1) <> arr(y - 1, 1) Then Call song
End If
Next y
MsgBox c 这里C值是空值
End Sub
主要是写个能根据表一的,H列的单号,去搜寻表2的相对应的单号的其中几列的信息,集和到一个C值中显示,子过程的C值是正常,但看不到C值为什么返回不了主程序??大腿 支个招。
Public b As String, c As String
===================
Sub 蓝月亮破损单号提取明细()
Dim c As String, xx As Workbook===================
c 已经定义为公共变量 . 又定义为程序变量 ,
msgbox 输出的是 程序的
Public b As String, c As String
===================
Sub 蓝月亮破损单号提取明细()
Dim c As String, xx As Workbook===================
c 已经定义为公共变量 . 又定义为程序变量 ,
msgbox 输出的是 程序的