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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

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