vba, macro, shift down after autofilter

mawar5530

New Member
Joined
Apr 5, 2020
Messages
38
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hi Friends,

I am new to vba, really need help to find solution.
After autofilter the selction of "Poitem" example, i want to change G coloumn number beloging to "Poitem" to "zero" value
i dont find any way to offset, because the range keep on changing acording to report, so the offset not working for me.

1586156618873.png
 

Attachments

  • Capture.PNG
    Capture.PNG
    28 KB · Views: 16

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Please ensure you use code.

add these lines before end sub.

VBA Code:
range("A" & Rows.Count).End(xldown).select
activecell.offect(1,0).select
 
Upvote 0
Thank you for your prompt reply.
But the code not working, even i have try similar code as well.
my problem to find the range after filter field in column g.
Please try to help!

Appreciate it very much.
1586159931131.png
 

Attachments

  • 1586160007913.png
    1586160007913.png
    20 KB · Views: 4
Upvote 0
its
activcell.offset(1,0).select

typo error :)
 
Upvote 0
Try
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).SpecialCells(12).Select
If you just want to add 0 to the cells then
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).SpecialCells(12).Value = 0

@mawar5530, in future can you please post your code directly in the thread (using code tags) so we can copy/paste it please as we can't from an image. Instructions on using code tags are in my signature block below.
 
Last edited:
Upvote 0
Try
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).SpecialCells(12).Select
If you just want to add 0 to the cells then
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).SpecialCells(12).Value = 0

@mawar5530, in future can you please post your code directly in the thread (using code tags) so we can copy/paste it please as we can't from an image. Instructions on using code tags are in my signature block below.

Ok understand and thank you for reply.

i will try test and see.
 
Upvote 0
Try
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).SpecialCells(12).Select
If you just want to add 0 to the cells then
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).SpecialCells(12).Value = 0

@mawar5530, in future can you please post your code directly in the thread (using code tags) so we can copy/paste it please as we can't from an image. Instructions on using code tags are in my signature block below.

thanks a lot, i really appreciated it work for me.

I will keep learning from this wonderful platform.

Regards,
Mawar
 
Upvote 0
Happy it helped and welcome to the forum.

If you have no manually hidden rows in the Autofilter range you can omit the SpecialCells(12) to make it a bit shorter i.e.
VBA Code:
Range("G2:G" & Range("G" & Rows.Count).End(xlUp).Row).Select
 
Upvote 0

Forum statistics

Threads
1,215,267
Messages
6,123,964
Members
449,137
Latest member
yeti1016

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