how to make a date & file name from a sheet become a parameter in a macro

akika

New Member
Joined
Aug 2, 2018
Messages
10
Office Version
  1. 2016
hi,pls help.

i have a main excel 2016 with a vba code in a button.

In sheet param, colum A is date and column B is file name.. After input the date DD-MON-YY
e.g "09-Oct-18" and file name can be anything prefix with the "_09-10-2018.xlsx";in that sheet 'Param'.;;

I want to use that data entry as parameter in the code.; How to do it?


If Format(Range("A" & i).Value, "d-mmm-yy") = "09-Oct-18" Then
Range("B" & i).Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R2C1,'D:\akika\files\[CATEGORY_99_TAS_09-10-2018.xlsx]Sheet1'!R2C1:R30C2,2,FALSE)"


Range("G" & i).Select
ActiveCell.FormulaR1C1 = _
"='D:\akika\working\[consolidate.xlsx]Sheet1'!R4C3"
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Else
If Format(Range("A" & i).Value, "d-mmm-yy") = "15-Oct-18" Then
Range("B" & i).Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R2C1,'D:\akika\files\[CATEGORY_99_TAS_15-10-2018.xlsx]Sheet1'!R2C1:R30C2,2,FALSE)"

Range("G" & i).Select
ActiveCell.FormulaR1C1 = _
"='D:\akika\working\[consolidate.xlsx]Sheet1'!R4C3"

Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


End If




End If
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Cross posted.
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

Please supply links to ALL the other sites where you have asked this question.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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