Command Button Programming

jvaught333

New Member
Joined
Aug 17, 2017
Messages
8
Good evening all. I am trying to create a command button that will do the following:
There are potentially a large number of rows
There are 9 columns of sortable data
I want to copy each row (the entire row) to a separate sheet as a summary page which has the condition of the Follow up date being any date today or before
How would I write this code?
Thank you for your help with this.
 
insert new rows or copy them into cells? I'd imagine it would overwrite what is there.
but best to check for your version what the options are. still, whatever you want can likely be done somehow
without knowing exactly your set up, i was describing the simplest way with no code
though I understand, from the question asked, that your preference is for a command button & code
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I don't mind how I do it as long as it works. I would prefer it run on open so that would be ideal, but the issue I am running into is when I try to create the query, it says I have no relational tables.
 
Upvote 0
Yes I think he want's code. I'm sure your better at this then me. So I'm signing off here for tonight and maybe you will write the code for him. Thanks.
insert new rows or copy them into cells? I'd imagine it would overwrite what is there.
but best to check for your version what the options are. still, whatever you want can likely be done somehow
without knowing exactly your set up, i was describing the simplest way with no code
though I understand, from the question asked, that your preference is for a command button & code
 
Upvote 0
Try this:

If this works we can then assign the script to run when workbook is opened:
Make sure all your sheets are named exactly as should in this script:
Code:
Sub Test()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim Lastrowa As Long
Dim ans As String
ans = "Tracker Items Due Today"
Dim Del As Variant
Del = Array("Business Processing", " Group Service Frequency", "Future Assets", "CMOT", "Systematic Payouts")
Sheets(ans).Activate
Lastrow = Sheets(ans).Cells(Rows.Count, "F").End(xlUp).Row + 1
Sheets(ans).Rows("2:" & Lastrow).Clear
Lastrow = Sheets(ans).Cells(Rows.Count, "F").End(xlUp).Row + 1
   
   For b = 0 To 4
       Lastrowa = Sheets(Del(b)).Cells(Rows.Count, "F").End(xlUp).Row
        
        For i = 1 To Lastrowa
            If Sheets(Del(b)).Cells(i, "F").Value <= Date Then Sheets(Del(b)).Rows(i).Copy Sheets(ans).Rows(Lastrow): Lastrow = Lastrow + 1
        Next
   Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Are you saying you have never used a Vba script before?
This for now is a module script. Assign the script to a button.

I always assume when people ask for things like this they are already familiar with how to use Vba scripts.
Is your Workbook Macro Enabled. Or do you not know what that means?


Do I just plug this into the main vba page?
 
Upvote 0
The workbook is macro enabled. I understand how it works, I just have not written vba or worked with vba for probably 10 years.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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