Code Help Looping!

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
I have the following code which I am attempting to search range(A2: to end) for any cells that contain text (basically non blank) and if so the list the variable in column B in a list...

when I run this code it keep looping like crazy... can't quite put a handle on it!

Code:
Private Sub CommandButton1_Click()


Dim mySheet As Worksheets
Set iSheet = Sheets("PLATFORM not in FRX")


x = iSheet.Rows.Count
ApplicationScreenUpdating = False

With iSheet.Range("A2:A" & x)
    .Copy
    .PasteSpecial (xlPasteValues)
End With




For iRow = x To 2 Step -1

If Application.IsText(iSheet.Cells(iRow, "A").Value) Then


z = Cells(iRow, 1).Value

theRow = iSheet.Cells(Rows.Count, "B").End(xlUp).Row + 1
iSheet.Cells(theRow, "B").Value = z
End If

Next iRow

ApplicationScreenUpdating = True



End Sub

Any advice would be awesome

thanks in advance,
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Boller

Banned
Joined
Apr 11, 2006
Messages
2,328
Code:
Private Sub CommandButton1_Click()
With Sheets("PLATFORM not in FRX")
    .[A:A] = .[A:A].Value
    .[B:B] = .[A:A].Value
    .[B:B].SpecialCells(xlCellTypeBlanks).Delete
End With
End Sub
 

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
reply

Ha Ha WOW!

Did I ever make that look more complicated than it is!!! :oops:

Thank you Boller! very CLEAN!

Chow!
 

Watch MrExcel Video

Forum statistics

Threads
1,122,216
Messages
5,594,885
Members
413,947
Latest member
gizmolucy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top