HELP! W/ Counting Data

BIGTONE559

Active Member
Joined
Apr 20, 2011
Messages
336
I'm trying to count data and based on the criteria paste data into another portion of the spreadsheet. I'm having problems because there is a blank in the column of data that i've specified however it doesn't appear to go in order when it's executing the macro, and it also stops once it reaches the blank cell.


Code:
Sub Count_Check()

Dim Chkrange As Range
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim myCount As Integer
Dim destrow As Integer




destrow = 18














x = 5
y = 5
z = 18



Set Chkrange = Range("D5:D30")

For Each cell In Chkrange

If Application.WorksheetFunction.Countif(Range("D5:D30"), Cells(x, 4)) > 1 Or cell.Value = "" Then


MsgBox (Cells(x, 4))



Range(Cells(cell.Row, 1), Cells(cell.Row, 5)).Copy Destination:=Cells(destrow, 10)




x = x + 1

destrow = destrow + 1





End If



Next cell



End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Does this work?
Code:
Sub Count_Check()

Dim Chkrange As Range
Dim x As Integer, y As Integer, z As Integer, i As Integer
Dim myCount As Integer, destrow As Integer

destrow = 18
x = 5
y = 5
z = destrow

Set Chkrange = Range("D5:D30")

For Each Cell In Chkrange
    If Application.CountIf(Range("D5:D30"), Cells(x, 4)) > 1 Or Cell.Value = "" Then
        MsgBox (Cells(x, 4))
        Range(Cells(Cell.Row, 1), Cells(Cell.Row, 5)).Copy Destination:=Cells(destrow, 10)
        destrow = destrow + 1
    End If
    x = x + 1
Next Cell

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,538
Messages
6,179,412
Members
452,912
Latest member
alicemil

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