1
Dim FromRang As Range, ToRang As Range
Dim UserCell As Range
'Ask the user to input the cell Range in which to search for the sub strings
    Set FromRang = Application.InputBox(Prompt:="Enter Search Range From:", Type:=8)
    Set ToRang = Application.InputBox(Prompt:="Enter Search Range To:", Type:=8)

For each UserCell in ("FromRang:ToRang")

给出类型不匹配错误

请帮忙..

4

1 回答 1

3

看过您之前的问题后,您不需要两个单独的变量来捕获范围。

Set fullRange = Application.InputBox(Prompt:="Enter Search Range:", Type:=8)
即您可以在输入框处于活动状态时选择范围。此外,您可以输入A1:A10

然后,你可以做

For each UserCell in fullRange
  ...
Next
于 2013-05-01T15:44:26.837 回答