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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

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!
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,157
Messages
5,835,715
Members
430,382
Latest member
legolas97

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