column data clean

i hve  this solution working as needed

because need change data as soon as posible

need clean button  for data in column B and E
to add new data
54565758_b--1-.xlsm
ADRIANA PACCOUNTING ASSISTANTAsked:
Who is Participating?
 
Ryan ChongConnect With a Mentor Commented:
try customize this
54565758_b--1-_b.xlsm
1
 
Ryan ChongCommented:
you could try like this:

Sub test2()
    Dim StartRow As Integer, LastRow As Integer
    StartRow = 5
    LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "B").End(xlUp).Row
    
    'Clear cells
    ActiveSheet.Range("B" & StartRow & ":B" & LastRow).Cells.Clear
    ActiveSheet.Range("E" & StartRow & ":E" & LastRow).Cells.Clear
End Sub

Open in new window

0
 
Ryan ChongCommented:
ooops, should be like this instead:

Sub test2()
    Dim StartRow As Integer, LastRow As Integer
    StartRow = 5
    LastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "B").End(xlUp).Row
    
    'Clear cells
    If LastRow < StartRow Then Exit Sub
    
    ActiveSheet.Range("B" & StartRow & ":B" & LastRow).Cells.Clear
    ActiveSheet.Range("E" & StartRow & ":E" & LastRow).Cells.Clear
End Sub

Open in new window

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
Tom CieslikConnect With a Mentor IT EngineerCommented:
You can do this by creating your own Macro and then create button with assigned Macro

First Enable Developer Tools

GO to File - Option - Customize Ribbon
On the left, check box Developer.

Click OK, now you should see Developer tab in Excel menu on the top

Click on Developer tool and Click on Record Macro
Select Name for Macro for Example DeleteData

Now select all fields you want delete.
Hit Delete Button
Now Click on Stop Recording.

In Developer tool click on Insert, and select Button

Place button where you want (make nice shape of it)
Select from Assign Macro Your Macro
Click OK

Now it's working

If you click on button it will delete fields defined in macro.

Capture.JPG
You can right click on button then left click to change button name

Capture.JPG
1
 
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
Ryan Chong thnaks for the fast reponse

but how i used that ?? im not an expert computer
0
 
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
Tom Cieslik   Thanks for the fast reponse

Great explanation   !!

you an Good Teacher
0
 
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
Ryan Chong

Captureqweds.PNG
0
 
Ryan ChongCommented:
change StartRow = 4

anyway, it seems working for me
0
 
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
i did but still the same

when i hit  the clear button
0
 
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
Thnaks best  experts Ryan Chong   and Tom Cieslik
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.