|
-
Nov 21st, 2011, 02:23 PM
#1
Thread Starter
New Member
[RESOLVED] VB6 For..Next not working
Hi everybody,
I was trying to use a macro in Excel 03 to convert a huge database of data. Those data contain a combinated text and numerical string. First the text string needs to be exported and pasted in to cells to the right. So I created a following loop to find out if the text-numerical string contains the searched data:
Sub Midovanie4()
Dim InitialRow As Integer
Dim InitialColumn As Integer
Dim Data As Variant
Set Cells1 = Range("B4:H9")
InitialRow = ActiveCell.Row
InitialColumn = ActiveCell.Column + 9
For Each Data In Cells1
If InStr(Data, "Ar") > 0 Then _
Data.Activate
Cells(InitialRow, InitialColumn).Value = "0"
Next Data
End Sub
If the string contains the searched data (Ar) then the cell is activated and 9 columns to the right from this position "0" is written.
But it doesnt work. Each time i run it it fills only the last cell of the range cells1 containing the searched data. All the other cells that contain the data too are kept untoched. Has someone a idea how to fix it?
Thank you
Shuter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|