i am not getting output with this code

bhandari

Active Member
Joined
Oct 17, 2017
Messages
359
Code:
Sub usingthecolumns_androwsproperty_to_spcify_a_range()
Range("A1:B9, C10:D19").Rows.Count 
End Sub
iam not getting count with this code
OUTPUT SHOULD COME IN F3
 
Last edited:

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Re: iam not getting output with thos code

Maybe:
Code:
Sub usingthecolumns_and_range_property_to_spcify_a_range()
Dim x, y
x = Range("A1:B9").Rows.Count
y = Range("C10:D19").Rows.Count
MsgBox x + y
End Sub
 
Upvote 0
Re: iam not getting output with thos code

Instead of giving X,Y

cant we use #1 code with the Msgbox?
Iam getting error"wrong number of argumrets andinvalid property assignment"
 
Last edited:
Upvote 0
iam not getting output with thos code

bhandari,

Try the following macro:

Code:
Sub usingthecolumns_and_range_property_to_spcify_a_range_V2()
' hiker95, 10/28/2017, ME1029096
Range("F3") = Range("A1:B9, C10:D19").Rows.Count
End Sub
 
Last edited:
Upvote 0
getting wrong answer @hiker95
result should come 19
as per your code iam getting=93
Code:
Sub usingthecolumns_androws_property_to_spcify_a_range_V2()
Range("A1:B9, C10:D19").Rows.Count = Range("F3")
End Sub
what's the differsnce if i use Range("F3") at end of the statement
y iam getting error?
 
Last edited:
Upvote 0
bhandari,
Your range consists of two distinct areas. You must calculate the row count for each area separately, then sum the two counts.
 
Upvote 0
iam not getting count with this code
OUTPUT SHOULD COME IN F3

Bhandari,

You did not supply any raw data to test with.

The code I suggested worked in a sample workbook/worksheet with some raw data that I created.


In order to continue I would like to see your actual raw data workbook/worksheet.

You can post your workbook/worksheets to the following free site (sensitive data changed), mark the workbook for sharing, and, provide us with a link to your workbook:

https://dropbox.com
 
Upvote 0
bhandari,

You do not have to supply your workbook/worksheet.

It looks like JoeMo has a solution for you to work with.
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,224,830
Messages
6,181,228
Members
453,025
Latest member
Hannah_Pham93

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