Button Browses To File To Generate String Of Location?
Nov 8, 2011
I want cell D28 to be text of the location to the file selected through CommandButton1.. tia
This is what I have so far:
Code:
Private Sub CommandButton1_Click()
Dim browse As Long
Set Application.GetOpenFilename("All PDF files (*.pdf*), *.pdf*", , _
"Choose a Filename") = browse
ActiveSheet.Range("D28") = browse
End Sub
View 3 Replies
ADVERTISEMENT
Feb 25, 2009
I've been using excel for quite sometime but have never tried the macro system or posting VBA code so I'm wanting to get my feet wet with a little project.
I want to make a button on a sheet that when pressed generates a random number between 3 and 18, ideally it would make a new set of random numbers if pressed again.
View 12 Replies
View Related
Nov 12, 2008
I am trying to generate a folder within a specific location (For now lets call it C:Jobs) that will be named as per the adjacent cell (Column H on attached)
Obviously if the folder already exists I want the code to stop.
But this code will have to generate a different folder for each row within the spreadsheet.
View 8 Replies
View Related
Mar 7, 2008
I received this code from an example I found once upon a time that was originally submitted by someone else. Right now the code enters the current date in a cell of the same row as the checkbox when it's checked. I need to revise it, or come up with something similar, that will reference the value of a cell when it is in the same row as the button (from the Forms toolbar) that is clicked to activate the macro. First of all, I don't know how to reference a Forms button in VBA.
Sub Process_CheckBox()
Dim cBox As CheckBox
Dim LRow As Integer
Dim LRange As String
LName = Application.Caller
Set cBox = ActiveSheet.CheckBoxes(LName)
' Find row that checkbox resides in
LRow = cBox.TopLeftCell.Row
LRange = "B" & CStr(LRow)
'Change date in column B, if checkbox is checked
If cBox.Value > 0 Then
ActiveSheet.Range(LRange).Value = Date
'Clear date in column B, if checkbox is unchecked
Else
ActiveSheet.Range(LRange).Value = Null
End If
End Sub
Here is some other code I already created. Unfortunately, because I don't know how to do the row reference, I had to create 25 different macros, which just bulks up the size of my file and slows it down. But here is what I'm trying to accomplish in my macro:.............
View 8 Replies
View Related
Feb 23, 2014
I have a requirement to download a lot of historical data files from the archieve of an website. The url goes something like this: [URL]....
This downloads file for 21022014 ie. 21-Feb-2014. I need to be able to have a facility to have a selection criteria on my user form (in excel) where I specify a date range and the macro automatically downloads all the valid excel files available within that date range (files for Saturday, Sunday and some holiday dates will not be available in the website archive database) one after the other (like at single clcik of button) into a specific location (predefined viz.. c:/Users/EOD files/) on my laptop. Best would be if I am able to select the save location run time by using a 'Browse' like feature where I go and choose my local laptop folder...same type when we try uploading a file from our laptop to the web..
View 1 Replies
View Related
Jun 4, 2012
Is it possible to write vba code that will generate a text file with ALL changes that were made to an excel file. Ex. If Cell A17 = "Monday, June 4, 2012" and a user updates Cell A17 to "N/A", I would like to know what the value was before and after the udpate was made.
View 8 Replies
View Related
Feb 8, 2013
I do routine tasks every day which involves opening 3 different files and pasting data into my main file. The data is always in the same format, and the 3 files are saved in the same location (3 different folders through). The 3 files are saved each day and the naming convention is constant, with only the date changing. For example, the files are always saved in C:My Documents and the files are called test_05.02.2013.xls. Tomorrow the file will be called test_06.02.2013.xls and so on.
So each day I will be rolling a file forward and I want to bring in the info from each of these files based on the new day.
How to do 1, and I will do the others (because the concept will be the same).
View 1 Replies
View Related
Oct 10, 2007
I am running WinNT and need to find the folder containing the default icons available for use on buttons in the toolbar window. I can copy the image but it saves as a picture (device independent bitmap). I want to be able to send the icon to other people so they can put it in their directory and choose to select it.
View 3 Replies
View Related
Aug 13, 2008
I thought I could use
View 12 Replies
View Related
Aug 22, 2013
I often need to save the user's current position on a worksheet, do some stuff then get them back to where they started. In the past I've saved the current location sometimes as a string and sometimes as a range.
Code:
Sub BackToRange()
Dim BackToHere As Range
Set BackToHere = Selection
' do stuff
BackToHere.Select
End Sub
Code:
Sub BackToString()
Dim BackToHere As String
BackToHere = Selection.Address
' do stuff
Range(BackToHere).Select
End Sub
View 5 Replies
View Related
Jul 30, 2009
I was wondering if i could get a hand with inserting a file. Is there a way to insert the file and have it placed a relative distance from the insert button without using cell references?
View 2 Replies
View Related
Jan 18, 2013
I've attached an example of the data I am trying to solve this problem for. Basically I am looking for strings of 26 blanks or more in a row, but I want to determine the ending location of the last string of 26+ blanks. I've been able to determine the location of the maximum string of blanks, but that max group of blanks isn't always the last set over 26.
Any link to find the location of last string of blanks of 26 or more? The example I attached is a good example since there are two strings of 26+ blanks with the last one being shorter. I've also include the answer I'm looking at the end of the data in the example.
Example.xlsx
View 2 Replies
View Related
Dec 9, 2007
In column B & C, starting at row 2, there are first names & surnames. In column H there is a grade for each name, eg B. Columns AC through AH hold subject codes for each name, eg 18E/Hs1 (potentially all columns could contain a code or only 1). The identifying part of the subject code is the first 2 letters after the / . So in the example the subject code 18E/Hs1 the 'Hs' signifies it is History. A table of subject code and their subject name is contained in a named range called Subject_ID (see below). I intend to make this range dynamic.
Subject .Subject
Code......Name
HsHistory
EnEnglish
ChChemistry
ITIT
PhPhilosophy
MpMaths (Pure)
PtPart-time
PyPhysics
SoSociology
BsBusiness Studies
SSSports Science
FrFrench
BiBuilding.
For each name (starting at row 2) I want to achieve the following: Scan across the range containing the subject codes (AC:AH), identify the first two letters after the / and match it to the subject name in the list. Paste the subject name to a cell starting at AI1 and then insert the grade (contained in column H) for that student in the corresponding subject column. The next unique subject name should then miss a column be pasted in AK1.
Example
......B ......C........H.. AC..........AD...........AE..........AF........AG.........AH.........
Matt........Pia......D....18A/Hs1...18B/En1....18B/Hs3
should result in the word History in AI1 and English in AK1 and the letter D in AI2 & AK2. Note as there is already a reference to History this is not repeated again.
I hope this is clear. I have enclosed a sample workbook with expected output and colour coded the subject names so that the order that they are pasted in is evident.
View 9 Replies
View Related
Aug 16, 2014
I am building a code based on a command button in a row, which will check is a worksheet exists (message), if not create a worksheet from a template (from another worksheet specific to a on a cell value in the same row), rename the worksheet based on a cell value in the same row.
I am having some success for each task with exception to relative cell values .....
As the code will be specific to the row (one button per row) Questions:
how to i determine the location of the button that is clicked? (I assume once this is established i can use to pull values in the same sheet on certain columns....?)
View 2 Replies
View Related
Mar 12, 2012
I am looking for some code which will return the location of the form button which is being clicked on to activate the macro. I would like to avoid using an active.x button if at all possible.
In this way I can use the same macro on a column of buttons to trigger an action based on adjacent cell contents.
e.g.
Name Button
Mr a Button1
Mr b Button1
Mr c Button1
The aim is to use the button on an index tab and to capture the name next to the button as a sort string for data on a separate tab.
I am running Excel 2010 on Windows Xp.
View 4 Replies
View Related
Jun 28, 2008
What i am trying to do is make a command button appear when you hit any cell of the row its on. For example, If you were to hit any cell on rows 1 or 2 the command button will appear and when I am not on the visible property goes back to false. I have a ton of buttons on this sheet and I am trying to clean it up so buttons only appear as needed.
View 9 Replies
View Related
Jun 9, 2014
sample pic.png
I have two spreadsheets of data I export regularly from an outside source. I want to consolidate the data from these two sheets into one large sheet with all the data in a more concise form bringing in only the data related to certain parts I am conducting analysis on. I have a list of these parts already. My first thought on how to do this would be to use the list in an entry for an input box and have that list be the index for a for loop in which i searched for a part code, copied the entire corresponding row, and pasted it back into the master sheet. I have gone through and tried to do this but I am running into problems because sometimes I have multiple rows of data that correspond to a single part number. I have attached a template of the way that the data should look in the master file with the multiple rows of details that correspond to just one part entry.
View 1 Replies
View Related
Jun 26, 2012
I'm trying to set up a system of sorts to track "services"
At the top of my 'new service" page, I need a button, which I then need to have a macro run on.
Sheet 1 is basically where I'd be entering the info, and sheet 2 where it would be stored. The button at the top is called Generate New "service' Number. This then needs to generate a new number on sheet 2 in A2 (then once 2 is populated, generate new in 3, then 4, then 5 etc...
I have a macro on Save Service Button at the bottom, which transposes the data into what would be used as a database to store all the services. That Macro then also needs to only transpose and paste data into the row corresponding with the "service number".
View 2 Replies
View Related
Jan 10, 2013
If n = 5, then I want to generate a string like this: "1+2+3+4+5". Similarly, if n = 7, I want the string "1+2+3+4+5+6+7".
I can generate the consecutive numbers, but have not figured out how to generate the required string.
View 5 Replies
View Related
Oct 25, 2012
I am using the following piece of VBA code in Excel 2007 to automatically generate an email when a button is pushed:
Sub SendEMail()
Dim Email As String, Subj As String
Dim Msg As String, URL As String
Dim r As Integer, x As Double
r = ActiveCell.Row
'Get the email address
Email = Cells(r, 3)
[Code] .....
The button to launch this code sits in cell AK7. What I would like to do is have the macro copy the email address present in cell E7 into the email address section of my created email. In addition I would like the reference provided in cell AJ7 to appear in the Message Subject part of the generated email in the format " RCS Reference contents of cell AJ7".
View 3 Replies
View Related
Jan 10, 2013
If n = 5, then I want to generate a string like this: "1+2+3+4+5". Similarly, if n = 7, I want the string "1+2+3+4+5+6+7".
I can generate the consecutive numbers, but have not figured out how to generate the required string.
View 2 Replies
View Related
May 2, 2014
I have an Excel 2010 spreadsheet that I am using to save several numbers all in the same column. These numbers can range from the several thousands up to billions. The formatting I am using for these numbers is Number (using 1000s separator).
number_forma.png
I am also using the spreadsheet to generate a text string for each of the numbers. I don't want the text string to show the number as it is, I want to shorten the number by only showing the first few digits followed by a "B" for billion, "M" for million, or "K" for thousand. For example, in the text string I want to show 1,600,000 as 1.6B.
In order to shorten the number I use the cell in the column to the right of each number. This cell uses the following custom formatting (which I found by doing a Google search): [>999999999.999]#.0,,,"B";[>999999.999]#,,"M";#,"K";
custom_format.png
As you can see the formatting is quite complex (at least for me it is) but it does what I want it to do.
Here is a screenshot of what the original and custom formatted cells look like:
custom_formatted_cells.png
As you can see the custom formatting works and does exactly what I wan
The next column (after the custom formatted number) is where I put the generated text string for each of the numbers. As I stated above, I want the generated text to use the shortened version of the number (e.g. 1.6B).
To generate the text I use the CONCATENATE function with a reference to the cell containing the shortened number as one of the arguments. For example:
CONCATENATE("SOME STRING ", B1)
Where B1 is the custom formatted cell.
The problem I am running into is, the text that gets generated doesn't show the shortened format of the number, it shows the full number. Here is a screenshot demonstrating what is happening:
concatenate_formula.png
As you can see the generated text is "SOME STRING 1600000000". This is not what I want. I want the generated text to be "SOME STRING 1.6B".
I think I understand what's going on. When the CONCATENATE function references a cell it takes the actual value of the cell and ignores any formatting. (I suppose formatting is just the way you see the data, not how underlying functions receive the data.)
My question is, how can I re-write the CONCATENATE function (or use another function, etc. available to me) to use the formatted version of the cell?
*UPDATE* I have attached my spreadsheet as an attachment to this post (tackyjan_excelforums.xlsx). Please note that it was created and saved using Excel 2010.
View 8 Replies
View Related
Mar 26, 2007
I have had my server removed that I had my default file location, when I go in to change any of my options the first thing it does is go look for this file location and brings back an error stating it cannot find the server. I cannot find anywhere else that I could change it.
View 9 Replies
View Related
Apr 12, 2007
way to construct my save file so that it saves to the correct location.
I have a a FileSearch that lookings in a specific Folder and the sub folders for a file type and then saves them to a different location. Here is the location of the save in regards to the original location...
Filesearch folder= C:path
Savefolder=C:path he folder its found in & " excel converted"
If that makes any sense, basically I need to call the path of the file I opened, but not including the file name.
View 4 Replies
View Related
Aug 18, 2009
I have a series of files, all named sequentially by date, for example...
Sales Report - Week of 2009-07-27 - NH.xlsm
Sales Report - Week of 2009-08-03 - NH.xlsm
Sales Report - Week of 2009-08-10 - NH.xlsm
...and so on. (The dates are always Mondays.)
I want to get the contents of a particular range on the previous file (e.g. the "RaceResults" range a.k.a. B4:B33 on "Sales Report - Week of 2009-08-10 - NH.xlsm")
View 2 Replies
View Related
Jan 19, 2010
if this is possible, but is there anyway to reference a file location in a formula using another cell?
EG:
Cell A2 (Text) = C:Folder1Folder2Folder3Sheet v1.2.xls
Cell B2 = =A2'tab1'!$A$1
So, in cell B2 it will use the file location in cell A2.
I need this because the values will be updated in Sheet v1.2 and version controlled (so if it changes to 1.3 all you have to do is change cell A2).
View 9 Replies
View Related
Jun 30, 2006
I am trying to write a macro which does a screen print of a couple of sheets in a spreadsheet. I created the macro using the recorder function and then trimmed it down a bit. However, when I run the macro it pops up with the box asking for a file location, and this is not something that the recoder function seems to write into the macro. I am not sure how to have the macro autofil the file location for the screen print. Is there anyone out there who can give me a hand with this? Thanks. The code for the macro is below...
Sub ScreenPrint()
Sheets( Array("Sheet1", "Sheet2", "Sheet3")).Select
Application.ActivePrinter = "Microsoft Office Document Image Writer on Ne00:"
Selection.PrintOut Copies:=1, ActivePrinter:= _
"Microsoft Office Document Image Writer on Ne00:", Collate:=True
Sheets("Sheet1").Select
End Sub
View 3 Replies
View Related
Aug 19, 2009
I have a database file with a list of components. Each component has manufacturers name, part number, description etc. I need to create an individual file from each of the components in the list. I would like a quick and easy way to copy the information in each Row and generate a new file for each Row containing the existing template I have.
View 9 Replies
View Related
Jul 1, 2014
I have an issue with saving the file at the desired location below is the code i have currently used . I have given the destination as "D:New folder". The new file does get saved at location "D:" but not inside the "D:New folder", instead names the file as "New folder".
View 3 Replies
View Related
Aug 12, 2014
I need to assign headers to a table according to the file name and location. I have attached the example spreadsheet. Sheet1 contains the table with the data and Sheet2 assigns the headers to each file and location. The code is skipping headers and I can not figure it out.
Macro Example.xlsm
View 4 Replies
View Related