Extracting Current Worksheet's Filename
Feb 9, 2007
how to extract the current/active worksheet's file's name using VBA code. Let's say I have a an excel file with the name "Test.xls" Which function do I use to return Test (with or without the extension)?
View 4 Replies
ADVERTISEMENT
Mar 20, 2014
I have a directory folder with an active workbook and another workbook id like to copy data from. The Following macro opens up a file in the same directory, copies some data and pastes it in the active workbook. However with this code I have to specify the filename, 'Data.xlsm' in the example code. I would like it to copy data from the only other workbook in the current directory WITHOUT having to specify the name in the code, so just opening it up no matter what filename it has.
In addition I would like to extract the filename from the workbook im copying data from and paste it into the activewoorkbook in sheet 1 Cell A1. I had a look at getopenfilename function but cant seem to make it work for my purpose.
View 4 Replies
View Related
Apr 3, 2014
I have the following code which successfully opens the specified workbook and copies the values to the active workbook, but then gives an error on the line of extracting filename, and when extracting last author. However, the code works fine if I use 'getopenfilename'.
[Code]......
View 8 Replies
View Related
Mar 10, 2009
I am trying to get a module wide variable to provide the current filename to the various subs.
View 2 Replies
View Related
Oct 14, 2008
I have a worksheet with 30,000 rows. But sometimes even if I have fewer records in this worksheet(lets say 1000) worksheet shows the same 30,000 rows.And its annoying when you try to navigate using vertical scroll bar. Is there any option to re-adjust the worksheet to make it more user friendly based on number of rows in current sheet.
View 2 Replies
View Related
Jun 12, 2007
In cell A1, I have the month number (eg, 1, 2, 3,). The month number reflects current month and will automatically change with every month. For example, right now it’s 6, next month it will automatically change to 7. Each two columns in Range A10:X20 represents the data from January to December. I want to use a worksheet event to change the background of the current month two columns in the range to yellow color and the two columns in the range will be visible when I activate this sheet.
View 3 Replies
View Related
Jul 15, 2008
I have a "cat_no" file and a "master inventory" file.
I need to do a vlookup to match the catalog #'s and mfr name in the cat_no file and the master inventory file. I also need to pull the pricing and packing string from the master inventory file and add it to the cat_no file where item numbers match.
View 14 Replies
View Related
Feb 28, 2014
I have an excel sheet with data results of samples analysis from ICP-MS the sheet includes the name of the sample and its results, I want to extract for each sample only the ( average value "x" , standard deviation "S" and " %RSD) and sort these values in columns , see the photo and the excel sheet attached ..
View 13 Replies
View Related
Jul 11, 2014
I currently have a macro that looks at one value and copies the data to another worksheet.
I'd like to modify it to look at two different values and then copy the data. I've tried modifying the VBA code, but can't seem to get it to work. In the "ETF Report (1)" tab, i want it to look at the "ETF Report" and "PO No" values.
The Final Version tab is what i'd like the results to look like.
View 4 Replies
View Related
Feb 15, 2012
Excel 2007. Is there a way to extract information from cells and rows that constantly move? These rows need to be able to cut & paste, copy & Paste, insert and delete. I have the formula I need to display the data, but with the cutting and pasting etc, my formulas get all messed up.
I have the excel sheet on Google docs. It displays some cells wrong because it does not recognize certain formulas.
[URL]
On the second worksheet, I want the information from columns A, H, M, N, and O to be extracted at a certain time each evening and sent to a worksheet, without sending duplicates. These rows will constantly move which is why my current setup, which is just to display the information, will not work... We decided to try to extract it into a different worksheet or workbook if possible.
View 1 Replies
View Related
May 18, 2006
As above, how do i retrieve excel file names in a specific folder and place the names into a specific column?
Say there are 2 files named UAT1.xls and UAT2.xls and i have a master file to put all this data in.
View 5 Replies
View Related
Feb 6, 2012
Is there a formula to get the Name of the current Worksheet and place it in a Cell? I have a Macro that will create a list of all of the worsheets within a workbook, but it requires indexing through all worksheets. I have not found the command that returns the name of the active worksheet.
View 5 Replies
View Related
Feb 6, 2013
I have a workbook with two tabs, Summary & January. The january tab has total expenses for the month of january that are subtotaled by last name. i.e. (baker total, decker total..). I would like to be able to use a formula on the summary tab to pull the values of each of the totals for each person from the january tab to the summary tab.
I tried on the summary sheet doing =jan and selecting the first persons name and then going back to the summary tab and dragging that formula down but it pulls all of the other data within the subtotal on the jan tab and I just want each persons total.
View 5 Replies
View Related
May 1, 2013
I have a table of data from which I would like to extract the information which is listed horizontally.
Column A Column B Column C Column D
Code Name Address Locality
SMITJOHN John Smith 123 Bell Rd Perth
On the 2nd worksheet I have a form which I have designed to which I would like to extract the information from the 1st worksheet.
I am hoping that it is possible to start entering a code based on some reference on the Name. Eg SMITJOHN
Once the code is true or correct it will populate certain cells on the 2nd worksheet automatically.
I work in transport and am looking to streamline some of the paperwork and am trying to do it within the means I have available to me.
The format of the 2nd worksheet is;
CODE: SMITJOHN
NAME: John Smith
ADDRESS: 123 Bell Rd
LOCALITY: PERTH
View 3 Replies
View Related
Mar 25, 2009
I basically need a macro to sort the sheet by V, U, T starting from row 3 and ending before the last vechicle. This is the problem though, the last vehicle ends everytime right before Car # in column A. So in other words in this example i would need it sorted by v u t, starting from 3 down to row 12. It ends at 12 because the next line includes car and a number.
Another sheet might have a longer list of vehicles and might end at row 100 before the next line has car number .
It always starts at 3, but the ending is dynamic where it should stop its selection before "car number ".
I would also like it to work on the current sheet im on, because i have up to 100 sheets like this and would not want it name dependant. Just want to click on a tab, and run a macro and have it sort from 3 down to the line before car in column A.............
View 3 Replies
View Related
Jan 22, 2013
What is the code to identify the current worksheet name? I want to store it in a variable so I can return to the worksheet later. I thought that the code was this:
myWorkSheetName = worksheet.name
:
:
Sheets(myWorkSheetName).Select
I receive a "Run-time error 424: Object required" message on the worksheet.name statement.
View 2 Replies
View Related
Apr 2, 2008
Does anyone know the VB syntax for obtaining a table name or number on an existing worksheet? I'm using Excel 2007 and have a worksheet that is one large table. I have a macro which copies the worksheet to a new sheet, converts the table to a range and then edits out the elements I don't require (my macro won't strip out information I don't require if it's still a table, which is why it's converted to a range). However, every time I copy the sheet, the table number increments by one.
For example: Unitlist is the original table name. When I copy the worksheet, the table on the copied sheet becomes Unitlist1. If I delete the sheet and copy it again, the table becomes Unitlist2 etc. etc. In order to get around this, I need to be able to reference the name of the table on the copied sheet and then use that reference to convert the table to a range. I can convert the table to a range using:
ActiveSheet.ListObjects("Unitlist1").Unlist
However, I need an automated way to obtain the table name. I've attached a copy of my macro for further reference.
Sub CopySheetDeleteData()
Dim c As Range
Dim i As Long
With Application
.Calculation = xlCalculationManual
. ScreenUpdating = False
Sheets("Units").Copy After:=Sheets("Units")
' rename the sheet
Sheets("Units (2)").Name = "ExportUnits"......................
View 2 Replies
View Related
Nov 6, 2009
I have a spreadsheet that I send emails from. Currently I use the .PrintOut command just before .send and it prints the email to the default printer. Instead of printing to the printer i want to print the email to pdf or any file for archive purposes. I would also like the file to be located on a network drive with a file name from a cell in the spreadsheet with todays date. Is this possible?
Currently the code looks like this:
VB:
With OutMail
.to = sh.Range("A1").Value [code]....
View 9 Replies
View Related
Dec 15, 2009
I need the cell address where the cursor is (in a non active worksheet).
View 5 Replies
View Related
Nov 6, 2009
I have a spreadsheet that I send emails from. Currently I use the .PrintOut command just before .send and it prints the email to the default printer. Instead of printing to the printer i want to print the email to pdf or any file for archive purposes. I would also like the file to be located on a network drive with a file name from a cell in the spreadsheet with todays date. Is this possible?
With OutMail
.to = sh.Range("A1").Value
.CC = ""
.BCC = ""
.Subject = sh.Range("H1").Value & " " & sarBody
.HTMLBody = strbody & "<br><br>" & "<H3><B>Specific Notes, If any...</B></H3>" & vbCrLf & varBody & Signature
.PrintOut
.send
End With
View 9 Replies
View Related
Jan 2, 2008
I put all my named ranges in a seperate worksheet in the workbook.
On a different sheet I have all my data with references to the named ranges. But what it gives me is the cell information from the sheet on which the named range is located and not on the worksheet where I actually need the calculations to be done.
How can I make the named range refer to the cells in the worksheet in which it sits?
Worksheet 1
---------------
1
2
3
4
Worksheet 2
--------------
I name the function Red apples
RedApples =CONCATENATE($A1&"Red Apples")
Worksheet 3
--------------
=RedApples
=RedApples
=RedApples
Question #1
How do I make the name reference in worksheet 2 refer to
the cells located in the worksheet in which i use it. In other words, when I use RedApples in Worksheet 3, it gives me what is sitting in A1 in worksheet 2 instead of in A1 on Worksheet 1.
Question #2
How do I make the name reference in Worksheet 3 keep stepping down along Column A in Worksheet 1?
Formula at issue in actuality is
=IF($S5>0.149,Morethan15,IF(AND($S5<0.15,$S5>0.999 ),Morethan10,IF(AND($S5<0.999,$S5>0.0499),Morethan 5,IF(AND($S5<0.05,$S5>0),Morethan0,IF($S5<0,Lessth an0)))))
the morethan15,10,5,0 and lessthan0 is defined in the last worksheet
View 6 Replies
View Related
Mar 31, 2009
I'd like to add a "save as" function into an existing macro that would automatically save my worksheet in a network folder using a filename and today's date (no slashes). I have read several other posts with a similar Q, but mostly what I am finding is answers with a very "situation specific" copy/paste-able macro.
So here is my situation:
Filename: FILENAME MMDDYYYY
Folder Location - Let's call it: \companyFile2009
View 9 Replies
View Related
Sep 26, 2011
I'm a novice at Excel trying to create some forms for work. My goal is to have a working workbook that holds all my values from multiple jobs that gets updated daily with additional worksheets that gets sent to me. I'd like to be able to hit a macro in my workbook that allows me to select a file that has been emailed to me and import their values into mine. For example:
While using my active workbook I want to select a file. Then take cells A1:A15 from selected file and paste to cells F1:F15 in my active workbook.
View 2 Replies
View Related
Nov 3, 2009
I have a worksheet that includes a cell that gives the current week of the month, in the form of "Week #". I've been using the formula below for several months and have had no issues until this month, and it's driving me crazy.
Given that cell D2 is the beginning of the week (usually Monday, but at the first of the month it may be a different day):
="Week " & ROUNDUP((DAY($D$2)+WEEKDAY(DATE(YEAR($D$2),MONTH($D$2),0)))/7,0)
I'm not sure where the logic is going wrong here; it's worked so well up until now. For the week beginning November 2, 2009, the formula above returns "Week 2" rather than "Week 1".
View 9 Replies
View Related
Jul 11, 2006
I have part of this routine working correctly. It will go and find the value I need and move to the next column using the Offset method, but now what am I doing wrong to try and get the code to select to the end of the current column?
Sub Find_First()
Dim FindString As String
Dim rng As Range
'FindString = InputBox("Enter a Search value")
FindString = Worksheets("Template").Range("A26").value
If Trim(FindString) <> "" Then
With Sheets("Service Level Score Paste Sheet").Range("A:A")
Set rng = .find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
rng.Select...........................
View 8 Replies
View Related
Nov 22, 2012
I know you can see it but If set to default when the mouse moves over an object it changes to that object's cursor. Access had a screen property that may have detected this change. Excel Examples On the worksheet the cursor is a cross If on a worksheet you have a shape with a macro the pointer changes to a hand On a shape without a macro the pointer is 6
HOW do you use vba excel to find its current number or send a message when it changes or peek message to notify when it changes
View 4 Replies
View Related
Jan 12, 2009
You could use:
If ActiveWorkbook.Sheets.Count < 17 Then
Application.CommandBars("Workbook tabs").ShowPopup
Else
Application.CommandBars("Workbook tabs").Controls("more Sheets...").Execute
End If
The code doesn't do anything on my excel workbook which currently has like 20 workbooks, and it grows daily by like 4 or 5 worksheets.
View 9 Replies
View Related
Oct 25, 2012
I have the need to email the current worksheet in Excel 2007, which I have been able to do with the following ...
Sub SendTab()
'Declare and initialize your variables, and turn off screen updating.
Dim wks As Worksheet
Application.ScreenUpdating = False
Set wks = ActiveSheet
[Code] .......
Is there a way I can also get it to also rename the sheet from the default "Book1" to the information in a referenced cell.
View 7 Replies
View Related
Jul 7, 2006
I am trying to display the Filename in a cell on my worksheet. However, when I enter the =Cell("filename"), it provides the full path (C:/Documents......Cost Summary.xls) How can I display only the filename without the path?
View 3 Replies
View Related
Jan 6, 2013
I have series of data values like below. I have to find Maximum, Minimum values for each of these values.
9430
9822
10070
[Code].....
View 2 Replies
View Related