clear rows

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Code:
Range("C5:C" & Rows.Count).End(xlDown).Clear
In the above line of code, data after C5 not getting clear.

I used this too
Code:
Range("C5:C" & Rows.Count).End(xlDown).ClearContents

Can any one quickly suggest on this
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try:
Code:
Dim x as Long
x = Cells(Rows.Count, 3).End(xlup).Row
Cells(5, 3).Resize(x).Clearcontents
 
Last edited:
Upvote 0
.. unless you were just trying to clear the yellow rows below, in which case one way is
Code:
Range("C5:C" & Range("C5").End(xlDown).Row).Clear


Book1
C
1x
2x
3x
4x
5y
6y
7y
8y
9y
10y
11
12z
13z
14z
15
Clear
 
Last edited:
Upvote 0
.. unless you were just trying to clear the yellow rows below, in which case one way is
Code:
Range("C5:C" & Range("C5").End(xlDown).Row).Clear
Or, alternately, another way...

Range("C5", Range("C5").End(xlDown)).Clear
 
Last edited:
Upvote 0
Thanks all, with the same im having very small query..
Code:
Worksheets("export").Select


lastRow = Cells(Rows.Count, "A").End(xlUp).Row


Sheets.Add

[COLOR=#ff0000]ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:="export!R1C1:R" & lastRow & C10, _[/COLOR]
[COLOR=#ff0000]    Version:=xlPivotTableVersion15).CreatePivotTable TableDestination:="Sheet4!R3C1", TableName:="PivotTable3", DefaultVersion:=xlPivotTableVersion15[/COLOR]

getting error on red - "Invalid Procedure on call Or Argument"

can any one pls guide on this quick pls..
 
Upvote 0
Thanks all, with the same im having very small query..
Is the clear problem resolved?

Next ask seems distinctly different to initial post so will pass
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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