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,
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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
 
Upvote 0
reply

Ha Ha WOW!

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

Thank you Boller! very CLEAN!

Chow!
 
Upvote 0

Forum statistics

Threads
1,214,608
Messages
6,120,500
Members
448,968
Latest member
screechyboy79

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
Back
Top