VBA Copy Cells to separate Sheet based on Year and Month columns.

dpabsher

New Member
Joined
Nov 2, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I think I have a good start, but I have not idea how to use the cells B16 (Year) and B17 (Month) to locate the correct row on a separate sheet to start copying to the table. Below is what I've come up with so far, I know it's incomplete and I'll need to add a bunch of Cell locations to copy over to the other sheet, I'm just not sure how to make sure they're pasting to the correct location. The Year and Month on the first Pic are drop downs. Any assistance will be greatly appreciated.

VBA Code:
Sub FindCellBasedOnDate()

'This value will be used to match the Selected Year Cell on FLTINPUT Worksheet
Dim CurYear As Variant
'This value will be used to match the Selected Month Cell on FLTINPUT Worksheet
Dim CurMonth As Variant
Dim FLTINPUT As Worksheet
Dim Table As Worksheet


Set FLTINPUT = Sheets("Flt CC Input")
Set Table = Sheets("Form Input Table")

FLTINPUT.Activate

CurYear = Range("B16").Activate
CurMonth = Range("B17").Activate

Range("E5").Select
Selection.Copy
ActiveSheet.Paste

End Sub
 

Attachments

  • Capture.PNG
    Capture.PNG
    178.2 KB · Views: 17
  • Capture1.PNG
    Capture1.PNG
    14.7 KB · Views: 16

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,214,599
Messages
6,120,448
Members
448,966
Latest member
DannyC96

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