VBA, insert file name into input box

diatex

Board Regular
Joined
Jan 16, 2004
Messages
96
HI
Iam using the following code kindly supplied by "Tactps" to display an "input box" in which the the file name is entered.

FileName1 = InputBox("Please input filename", "Filename")
ChDir "c:\"
ActiveWorkbook.SaveAs Filename:="C:\" & FileName1, FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

Instead of manually entering the filename i was hoping to pick the filename up from a cell (G3) so that it would appear in the "input box" purely for visible confirmation which can be OK ed. I have been playing around with the following code adding it to the code above without a glimmer of success.

Activeworkbook.SaveAs Filename:=range("G3").value

Although this line saves the file as "G3" it does so without any visual indication or conformation. Any help to fill the "input box would be much appreciated.

Tryed and failed once again

Diatex
 
New Question

New Question.

I want to select only a certain block of rows that I input into two contention boxes. I.E

Row1
Row2 (I want to select this row up to row eight)
Row3 (selected)
Row4 (selected)
Row5 (selected)
Row6 (selected)
Row7 (selected)
Row8(End this row)
Row9
10

Here is the script I was using but having no luck with. Can anyone help?
------------------------------------------------------------------------------
Contention = InputBox ("Please type in row number of the cell that is highlighted", "Please type in row")

contention = "A" + contention

contention2 = InputBox ("Please type in row number of the cell that is highlighted", "Please type in row")

contention2 = "A" + contention2

Range(contention & ":contention2").Select

Selection.Copy
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,836
Messages
6,193,243
Members
453,783
Latest member
Chandni

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