Autocopy the first cell with more than 30 characters to a different sheet?

S

Simensg

Hi. I am using Excel 2010.
I have a workbook with a web query.
Is it possible to autocopy the first cell that has more than 30 characters to a different sheet?
It would help me a lot, because I then could see if there were any changes from the Website.

Example:

"Sheet1"
Range F1:F238.

F1:F20 String < 30 characters. Don't autocopy
F21: => 30 characters. Then copy to "sheet2" A1

Thanks in advance.
 
C

Claus Busch

Hi,

Am Tue, 11 Dec 2012 00:23:56 -0800 (PST) schrieb Simensg:
Is it possible to autocopy the first cell that has more than 30 characters to a different sheet?
It would help me a lot, because I then could see if there were any changes from the Website.

try:

Sub Test()
Dim rngC As Range

With Sheets("Sheet1")
For Each rngC In .Range("F1:F238")
If Len(rngC) >= 30 Then
rngC.Copy Destination:=Sheets("Sheet2").Range("A1")
Exit For
End If
Next
End With

End Sub


Regards
Claus Busch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top