Dim FileToOpen
FileToOpen = Application.GetOpenFilename _
(Title:="Please locate BlankSAMSRegister.xlsm", _
FileFilter:="BlankSAMSRegister.xlsm (*.xlsm),")
If FileToOpen = False Then
MsgBox "No file specified.", vbExclamation, "Error"
Exit Sub
End If
Once this second workbook is open, how do I refer to each one within the subsequent code?
I really need the parent workbook to be named as wb1 and the child to be names wb2 so I can flick between the two in the next macro... I can get the parent using thisworkbook.name, but how do I get the child?
I have the following code that creates a new workbook and names it after the value of a cell in another workbook. Another part of the macro will switch back and forth between the original workbook and the newly created workbook.
What is the best way to refer to new workbook? I'm familiar with the "workbooks "VARIABLE NAME".Activate" style but, the name of the new workbook will change every time the macro runs and I'm not sure how to refer to it.
the code below.
HTML Code: Sub MakeNewBook() Dim wB As Workbook Dim nPath As String
I have to excel files, both have the same data. I created a pivot table macro on the first file. I want to be able to open the second file and use the shortcut to create the pivot table. the problem is that it refers back to the original workbook I created the macro on. How do I change the code to make it refer to the current workbook?
At the moment, I have a project where everyone is putting work data on seperate workbooks. Each months work is placed onto another worksheet within that workbook.
The supervisor has his own workbook, that grabs data from each of the workers books. Getting the data is easy enough, however because the supervisor has barely any knowledge of computers, I would like to make it as easy to set up for future months.
Right now, data is collected in each cell using the following formula:-
='[otherusersworkbook.xls]December 2009'!$C$620
Is there a way of getting that phrase to substitute the part that says "December 2009" with whatever is put into column A on the same row?
In Excel, I want VBA to refer to the SENT ITEMS folder in Outlook. I want to loop over all sent items, and if the email address satisfies a condition, then record that fact in Excel. I am good at VBA in Excel, and I have a passing knowledge of VBA in Outlook, but I don't know how to refer to Outlook within my Excel VBA.
I have a check box whithin a worksheet. This CheckBox doesn't have any linked cell, and doesn't have any macro asigned. know I would like to refer to the value of the checkbox by vba kind of: ?ActiveSheet.Shapes("CheckBox1").value=true 'from the vba's inmediate window
I have multiple sheets as Name1 ; Name2 ; Name3 and each sheet have a value on cell A1 for any number let say between 0 to 100. On another sheet call SheetName, I have A1=Name1 ; A2=Name2 ; A3=Name3.
I have formula as:
[Code] .....
The INDIRECT formula work to refer each cell A1 in each sheet, however if the sheet name include a space then it won't work anymore. How to make it work with the sheet name with space?
The summary page summarises the source data into how much revenue each department has made over 12 months.
However the formula in Summary worksheet column B will only total up the amounts if the month in the Source worksheet column B is the 1st of the month. How do I change the formula in Summary worksheet column B to purely go by month and ignore the day?
The "summary" tab will be calculating 20 statistics for each of the 30 or more tabs. In an effort to automate this - can I replace writing "January!" with a cell reference? For example; instead of writing = sum(january!a:a). Could I write = sum("A1"a:a), with the A1 Cell = january!. Obviously I tried this and it does not work but I am not sure if there are other options.
I've got a workbook that increments in sheets for each new week. I have a cell showing the current week number for that sheet ( lets say cell C1) and any formulas that need to reference data from the previous sheet do in 'indirect' function which basically looks at the current week number ( lets say week 20)in cell C1 and minus's 1 to navigate to the previous week (week 19).
I was wondering if there was a way to reference the previous sheet purely by the order they're in.
So say i have 5 sheets named "1,4,5,8,9" and these represent week numbers so the sheet named '8' in cell C1 would have '8' standanding for the week number but cells that wanted to reference the previous sheet couldn't do the 'indirect' C1-1 as there is no 'week 7'.
The weeks used could vary alot so a formula to reference the directly previous sheet is needed.
the '$A$G2-1' part is the bit that redirects to the previous sheet based on it's name, what i think i really need is to replace this part with a 'PrevSheet' function but i'm unsure how.
I'm trying to do is add a signature box (for inventory-taking accountability) directly below the pasted area after I paste it. Now, of course, the copied and pasted area could have 5 rows or it could have 15, and when I copy it from the first sheet and paste it into the second it doesn't preserve the name of the range on the second page, so what I really need to do to add the signature box directly below the last row in the pasted area is specify the location in relation to the last row in the pasted selection, but I don't know how to do that. Using ActiveCell always refers to the top-left-most cell in the selected area. So...
If I have an area selected, how do I refer to the bottom-right-most cell in that selection (in the same way that ActiveCell refers to the top-left-most cell)? Or at least the bottom row? Or, even better, the row below the bottom row?
A2 refers to a linked cell but I have tried without the link there still no joy. Together they would generate for example "DCA_RES" which would refer to a column range in a different sheet on the same workbook.
I want this to work so that I can implement more easily new lines to refer to different sheets. (Drag to copy) instead of having to copy and edit a formula 100 times.
I'm trying to call a function that is stored in a cell as a text string. In cell A1, I have the text Sum('Sheet1:Sheet3'!C3). I want to call this function from a different cell. Is this possible using the pre-defined functions, or would I be better creating my own function?
I have a selection that I am going through with a 'for each' and then performing actions if the cells meet a certain criteria. I have been referencing nearby cells with the offset function, but now my sheet is too big and I need to change the code often and the offset function is difficult, is there anyway to refer to cells without the offset function, preferably by column letter
PHP Code:
For Each Cel in SelectionIf Cel = x Thenvalue1 = Cel.Offset(0,39).Valuevalue2 = Cel.Offset(0,5).ValueEnd IfNext Cel
with the below code i want the highlighted in red (RC11) to refer to last column and last row.
Code: Sub try () Dim finalrow As Long Dim finalcol As Long Set wspo = Worksheets("Previous Order") wspo.Select finalrow = wspo.Cells(Rows.Count, 1).End(xlUp).Row finalcol = wspo.Cells(1, Columns.Count).End(xlToLeft).Column
In my current spreadsheet I use Offset to change the values of various cells. The problem is that if I make any changes to the columns it throws the whole offset thing off. So, instead of using offset to paste all the data is there an alternative that would work better?
I was thinking maybe I could name a column as a range and then have the cell in that row equal a value.
It has a tab for every week in a year so 52 in total. The first tab is supposed to give some general information. I have a few questions on how to implement things.
1 i wanna be able to view the Total amount hours worked in my current week.
How can I use (with or without macro) cell text to refer to different worksheets inside a formula. For example I've formula =INDEX(Mary!B9:E17...) but I wanted to write that 'Mary' or whatever sheet name to a cell in one sheet and sheet refenrence in this index-formula would change accordingly.
I have a cell containing a 'bullet' symbol (•) and a cell containing text.
If I make the bullet red and the text is black is there a way I can combine them in the same cell and the bullet remains red and the text black?
Essentially the situation Im in is I have a load of text I need to add coloured bullets to and I dont want to individually paste in and colour format all the bullet points because it would be too time consuming.