How to provide a variable in the for loop to loop through a range

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")

giving type mismatch error

Please help..

Answers


Having looked at your previous question, you don't need two separate variables to capture the range.

Set fullRange = Application.InputBox(Prompt:="Enter Search Range:", Type:=8) i.e. you can select the range while the input box is active. Also, you can type in A1:A10

And then, you could do

For each UserCell in fullRange
  ...
Next

Need Your Help

Jquery accordion code

jquery accordion jquery-accordion

I found that code on the internet:

What kind of strings does CFStringCreateWithFormat expects as arguments?

osx unicode printf cfstring

The below example should work with Unicode strings but it doesn't.