Create A Single Range From Multiple Ranges For VBA Input
I have a VBA function with the header:
cubspline(Xval As Double, XRange As range, YRange As Range) As Double
The problem is that XRange (and also YRange) is in different areas of the spreadsheet. I want to combine these areas into one range which I can pass on to the cubspline function. What is the easiest way of doing it? I'm looking for something like a "union" function for ranges in Excel.
View Complete Thread with Replies
Sponsored Links:
Related Forum Messages:
VBA Function: One Range As Input, Two Ranges As Output
I want to pass an array to a function, and am unclear how to do it. For example, the following declaration does not work: Public Function xyz(a() as Variant) as Double There is an additional requirement that I would like the output also to be a range of the same dimensions, typically one column and 100 rows. Is this possible? A further twist is that the function I am writing calculates two values for every element in the input array and I need the output of them both. An inelegant solution would be to write two separate functions, but I was wondering if it is possible to get two array outputs from a single function.
View Replies!
View Related
VBA Macro To Create Multiple Data Validation Lists From Variables & Named Ranges
I cant seem to find the correct syntax for creating 14 validation lists using array members as the source of the named ranged. The validation lists are stored on a different worksheet, the Named Ranges are created fine, as are the ranges that are having the validation applied. The Syntax I am having a problem with is Public Sub assignDVList(WSD As Worksheet, sListName As String) Dim DVListName As String DVListName = "DV" & sListName Application.Goto Reference:=sListName With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=" & DVListName It is the Formula1:="=" & DVListName that is creating the headache. The sub is called as the array moves through the columns, using the header row as the Name for the Named Range, and the data Validation worksheet uses the same naming except it has DV in front.
View Replies!
View Related
Single Input To Multiple Reports
I'd like to be able to drop one table of data into a workbook that already has sheets of two or more master tables, and two or more report pages. A formula on the report pages would compare aspects of the data to the master tables, and report the data on the correct sheet based on certain criterion. The reports would not have blank spaces, need to be sorted further, etc. My initial impulse was to think in terms of ol' verable VLOOKUP, but I can't figure out how to get the report formula to move on to the next line of the data table if it doesn't find a match for the first line - short of adding another VLOOKUP (and another, and...), which is totally impractical given that the data table will likely have 20,000+ lines.
View Replies!
View Related
Sum Of Multiple Ranges Sharing A Single Criteria
IM trying to add the result of multiple ranges sharing a single criteria and have had no luck. I am trying to get the range from every other colum and have the total qty of the selected criteria display in a single cell. The best way to describe is countif with multiple ranges and a single criteria. perhaps countif isnt the answer, it is the only way i know to describe the issue though.
View Replies!
View Related
Create Multiple Workbooks From A Single Workbook
On a weekly basis, I receive a single worksheet in a workbook that contains ~30,000 rows of product sales. Row one contains column headings that is unique to all other rows. Column A contains the store number that sold the product. There are ~50 unique store numbers. I am trying to create a macro that will break the report up into seperate workbooks. For example, assume in column A there are 30 rows of data for 3 different store numbers (say store 112, 386, & 798, each with 10 rows of data). I want to create 3 new workbooks and include the same column heading for each. For example, name new workbooks as follows: "Store 112", "Store 386", "Store 798".
View Replies!
View Related
Create Unique Lists From Multiple Ranges
I have values in Worksheet 1, spread over A1:D25 and A200: D250. In worksheet2 I have values again from A1:D25 and A200:D250. Is is possible to only get the unique values of those 4 ranges with the advanced filter? They all need to be shown in eg worksheet 3 starting in A1, (so kinda merged in a sense)? Is that a thing more for a UDF, or is there a excel function/option that does exactly that? I have been looking for ages for that kind of function/option, since I thought it must be possible. But this sure does not look to be a standard functionality, or is it? Is there a (free) add-in that might do this kind of thing? I found this code on some office help page: Sub SortAllRangeData() ' Place column header for temporary sort area. Range("IV1").Value = "Numbers" It kinda does what I needed, but it lists the actual data in the same spot it used to be. I want to be able to list the sorting in a different column on a different sheet and in 1 column only. Is this difficult to modify so it becomes a UDF or is this something totally different?
View Replies!
View Related
VBA To Create Charts/Graphs From Non Continuous Ranges
I have an excel sheet populated with loads of values. There is a space between each set of data. I need to draw a graph for each section and i cant work out how to do it. I have attached the sheet in question. The gap between each column has "space" written on row, which is needed to prevent it being deleted. The drawing of the graphs needs to be automated as there is going to be 100's of sheets containg lots of data. The column size of each section can change so it needs to be dynamic. I have attached an example sheet
View Replies!
View Related
Multiple Vba Commands On A Single Line
Is it possible to have multiple VBA commands on a single line with a separator ( ; or , ) of some kind? I am trying to keep my code as short as possible (from a scrolling perspective) and would like to have something like the following: Dim MyArray(1 to 20, 1 to 3) MyArray(1,1) = "Sheet1" ; MyArray(1,2) = "D8" ; MyArray(1,3) = "D9" MyArray(2,1) = "Sheet1" ; MyArray(2,2) = "C49" ; MyArray(2,3) = "w3" MyArray(3,1) = "Sheet1" ; MyArray(3,2) = "A23" ; MyArray(3,3) = "AB12" MyArray(4,1) = "Sheet1" ; MyArray(4,2) = "Z19" ; MyArray(4,3) = "W12" MyArray(5,1) = "Sheet1" ; MyArray(5,2) = "Q32" ; MyArray(5,3) = "Q23"
View Replies!
View Related
Importing Data From Multiple Word Forms Into A Single Spreadsheet With Vba
I would like to use a vba procedure/procedures to achieve the following: I have a folder with many Word2003 forms in and I want to save just the data from each form and then import the data into an Excel spreadsheet. Currently I am opening each .doc file in turn, saving just the data to a new plain text (comma separated file) in a different folder and am unable code searching that folder for all the text files and importing them into the spreadsheet. I have a two part question to my current approach: 1) I am 99% there with the first part (opening and converting the forms) with the following code having followed advice from another thread but I need Word open and not showing an open document. Is it possible to add code to take care of opening Word in the background and close it again after so the process is fully automated?:
View Replies!
View Related
Copy Single Cell Paste Range VBA
The following does paste the formula into the dynamic range, however, it doesn't move on to the next step in the code. It seems to get stuck on the last line. I let it run for 5 minutes and it still did not move to the next set of commands ...
View Replies!
View Related
Import Set Range From Multiple Files Into Single Worksheet
I've got a single folder for the year 2009 that contains multiple files, identical in nature but updated for each business-day. In other words, the same report is generated daily with updated info. The naming convention is the same for every file (i.e. Daily Net Debt Report 02.2.2009.xls) My ultimate goal is to have a macro that is dynamic enough that if its run on any given day of the year, it pulls the data (specifically from the worksheet "Detailed Cash" cells C1:E26) from every file included in the folder and places it in a single worksheet in the master file. So, for example, data from 1/2/09 would go into cells A1:C26, data from 1/3/09 would go into cells D1:F26, etc...
View Replies!
View Related
VBA To Select User Multiple Selected Ranges
The User has made multiple selections with the mouse. The spreadsheet is filtered. The user will usually make different multiple selections on the following columns: A and X through to AR (inclusive). I just need some code to capture these various multiple selected ranges so that I can copy the selected range as shown below:
View Replies!
View Related
Form Range From Ranges On Multiple Sheets
Is it possible to form a single Range object from ranges on multiple sheets. So for example, would it be possible to set a Range object equal to cells A1:D146 from Sheet 1 and A1:B49 from Sheet 2 and if so, what would be the syntax? For the first I have: Sheets("SelectData").Range("A1:D146").SpecialCells(xlCellTypeVisible) but I wouldn't know how to proceed from there.
View Replies!
View Related
Date Range: Reference A Single Date And Output Date Ranges
I need to create formulas that reference a single date and output date ranges. The objective is to have a person input a Monday date in any given month and receive a four weeks out worth of dates and ranges. For example: In a lone cell, the person inputs 10/13/08. Automatically, the sheet produces the next full week range: October 19 – October 25 in a single cell and also produces a cell for each date. Example: Sunday 19, Monday 20, Tuesday 21, etc…. It should look like: Monday Date: 10/13/08 October 19 – October 25 Sunday 19 Monday 20 Tuesday 21 Wednesday 22 Thursday 23 Friday 24 Saturday 25 and then repeat for three more weeks. I thought I had it figured out until the month changed. The dates continued in October instead of adding a month. This report will be ran weekly, so simply adding a +1MONTH to some cells will not benefit me as I’ll have to change the formula every week. I want the formula to compute the data without any manipulation over the next several years. The only change will be the Monday date.
View Replies!
View Related
VBA To Open Multiple Spreadheets And Copy/paste Cell Ranges
In my consolidating spreadsheet there are 6 columns that show the file path, the worksheet name, and cell range to copy. There can be an unlimited number of rows (each row represents another path). I would like the VBA to copy/paste values from each range specified in each row and copy them into the consolidating worksheet named "copied". Each time the VBA copies/paste values from the cell range specified in each row it needs to copy below the previous copied and pasted information in the worksheet named copied. In the worksheet with the file paths etc shown below (named "list"), I would like the VBA to show the Date and Time each piece was copied and pasted. For each path I would like to show in the last column if the copy and paste operation was successful ("yes" or "no"), this is more or less the error handeling....
View Replies!
View Related
Find Multiple Instances Of Single Criterion In Row & Return To A Single Col
Find Multiple instances of Numeric Criterion in Row & Return To a Single Column. I have a Dynamic Named Range "Data" spanning 10 Columns and many Rows. Each Row may contain duplicates of the Numeric Criterion. I would like to find ALL instances of a specific Numeric Criterion across each single Row in the Dynamic Range "Data" and have the Results returned to a New Sheet in a single column. NEW Sheet: The Numeric Criterion is housed in G5. The matched criterion should be returned to the New Sheet starting at G7. Duplicate instances in the same Row should ALL be returned to the same cell in Column G on the New Sheet. Sample Data Layout: Columns I J K L M N O P Q R Row No.76 1 0 1 1 0 1 1 1 0 1 Row No.77 2 2 3 2 1 2 2 0 0 0 Row No.78 3 3 3 3 3 0 3 0 3 0 Scenario: Looking for Numeric Criterion 1 (one). Expected Results - New Sheet: Row No.7 Column G (Cell G7) 1111111 Row No.8 Column G (Cell G8) 1 In Row 76 of the Sample Data ALL seven Numeric Criterion of 1 (one) should be returned to the same cell G7. In Row 77 of the Sample Data there is only one Numeric Criterion of 1 and it should be returned to cell G8.
View Replies!
View Related
VBA Macro Code To Create Multiple Charts
I need to create 63 charts from data which I have in two columns. I want to create multiple charts using one macro. For the first chart I want it to use cells K2:K80 as the x values, and M2:M80 as the y values. For the next chart I want it to use cells K81:K159 as the x values and M81:159 as the y values. For the next chart I want it to use cells K160:K238 as the x values and M160:M238 as the y values. I want to continue this, creating a chart for every 78 cells of data, all the way until the 63rd chart which uses K4900:K4978 as the x values and M4900:M4978 as the y values. I have created the following macro by " recording." This macro generates the first chart that I want: Sub Macro5() ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).XValues = "=Sheet1!$K$2:$K$80" ActiveChart.SeriesCollection(1).Values = "=Sheet1!$M$2:$M$80" ActiveChart.ChartType = xlXYScatterSmoothNoMarkers ActiveWindow.SmallScroll Down:=-3 End Sub How can I alter this macro to create all 63 charts?. It seems like there is an easy way to do this, but I don't use macros very much (at all).
View Replies!
View Related
Create A Named Range In VBA For Column A, Which Is A Sum Of B And C
I would like to create a named range in VBA for column A, which is a sum of B and C. The problem is that A can have 0 as a value. What I would really like to do is define the named range in column A as A2 to the last column with a value in column B(B10) which would make the named range in column a A2:A10. ABC 61555560 00 1250120050 725725 00 850850 1919 7216720016 995995....
View Replies!
View Related
Extracting Postcode Ranges To A Single Cell
I have a very large spread sheet of about 20,000 rows. I need to output to a cell postcode ranges based on the Zone. Not all the numbers in the postcode zones are consecutive. For the example below, the output cell for the DWN range would display like this: 0800-0801, 0804, 0810-0813 Each output cell postal range must be specific to each zone. Postcode Zone 0200 CBA 0200 CBA 0221 CBA 0800 DWN 0800 DWN 0801 DWN 0804 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0810 DWN 0811 DWN 0812 DWN 0812 DWN 0813 DWN Is there anyway to do this without manually doing it? I would like to tell you I've tried this and that but I've never done anything like this before so I really don't know where to start.
View Replies!
View Related
Check Whether Transpose Ranges Are Equal In Single Cell
How a single-cell formula to check that 2 transpose arrays are equal. For example, A1:A5 are {1,2,3,4,5} AND B3:B8 are {1,2,3,4,5} Is there an array formula in C3 for example, that will check (i.e. say TRUE) if corresponding ranges are true i.e. check in this cell that A1=B3, A2=B4,...A5=B8.
View Replies!
View Related
Switch Between Ranges Of Cells To Data Input Alot
I basically need to switch between ranges of cells to data input alot. so i thought of making a fixed field to enter the data which transfers the data over to designated cells . Attached is an example. I am not too sure which one will work, the If statement captures the data but when i switch out , the entry is gone .
View Replies!
View Related
Userform Create Input Boxes
How would I go about making a user form that has an input box where you can type in a year (in yyyy format), and then two radio buttons that allow you to choose either "Jan-Jun" or "Jul-Dec", and a submit button to run a corresponding macro. The purpose of this is I have two macros that run the same report, one is for first half of the year, second is for second half of the year. For simple purposes we will call them "JanJun" macro and "JulDec" macro ...
View Replies!
View Related
How To Create A User Input Dialog Box
I have a macro that's running quite well and is cross-posted here: [url] What I need to do is allow for user input. I want to create a dialog box that pops up and asks for an input range, when the user runs the macro. Values can only be from 1 - 50. And the user won't be allowed to select broken sequences, like 6, 9, 12-15. They would have to be continuous, i.e. 6 - 15, etc. I'm still very new to VBA. I can play with the control toolbox, but I have very little understanding of how to interface with the components that I'm adding/creating. Once I have that range, I want to use the inputs as the 'start' and 'stop' points for my loop. So I need to capture the values and pass them as input parameters, I'm guessing. I can modify the loop to accept the inputs, I'm just not sure how to capture them from a user input dialog box.
View Replies!
View Related
Create A Cell That Allows The User To Input A Number
I am working on a spreadsheet and would like to create a cell that allows the user to input a number (1 to 5) which will then equate to a percentage(%). I would then like this to deduct that percentage from a total number... To try and explain this.. Should the user input 1 into the cell, this would then equate to 3% - this would then deduct from a total that percentage. Input 2 = 5% etc..
View Replies!
View Related
Create Input Box / Save File As
I am looking for some macro code to create an Input box which will prompt the user to enter a specific date (not todays date so NOW function is not appropriate). This will in turn cause the file to be saved in a specific folder with the date becoming the name of the saved file.
View Replies!
View Related
Create User Input For LARGE Function
I want to create a user input for a "LARGE" function so that I can then return the specified # of "large" items. i.e. user wants to get the top X number of users, user then enters number either into a dialog box or cell, code then looks at the number and populates a range of cells based on the input value. The current code that I am using simply refers to an existing table (r9:r30) that I then used the auto fill to copy to cells below it. =INDEX(Sheet2!B$20:B$961,MATCH((LARGE(Sheet2!$F$20:$F$961,$R9)),Sheet2!$F$20:$F$961,0)) I really want to be able to just get a user dialog box going that will automatically populate both the range r9:rx (where X is the user input) and then also copy the above formula into the x number of cells below it.
View Replies!
View Related
Lottery Number Generation: Create A Single Line Function
You must install "Analysis TookPak-VBA" before doing this; check in your Excel's Tools/Add-Ins menu. Paste this long function (see below) in an Excel's worksheet (any cell) and press F9 (calculate) until you see at least 2 identical numbers. Real life's lottery does not have repeating numbers. I can disable this repetition by using cells relation but I want to use just one (1) cell. Any expert wants to challenge? If not, you can use VBA. But it still requires one (1) line of codes. =RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)
View Replies!
View Related
Create Dynamic Ranges
I have just upgaded to Excel 2007 and previously used a Dynamic Range Wizard addin in Excel 2003 but it does not work in 2007. I think it originally come from Robert Bruce but can not find it on the web to get an update.
View Replies!
View Related
Vba For Multiple Addresses Via Range
I'm trying to draft together a simple VBA script or even =HYPERLINK string to utilize a range of cells in Excel for the To: field in an Outlook email. I have 7 columns each with categorized for different individuals in different departments. Instead of dealing with contact groups, I have created a spreadsheet that breaks down the departments and supplies the email address for everyone in the department. So, what I want to do is make a link or button for each group that when it is clicked on will open a new email via outlook with all of the addresses in the appropriate range in the To: field. Example: Cell: A1 is the heading Cell: A2 is the link/button you would click on Range: A3:A255 would contain the addresses. One other thing, I'm not positive if this is an issue or not...The script might need to add the customary semicolon and space after each address added to the To: field...As needed when using multiple addresses in Outlook.
View Replies!
View Related
Use IF And AND Functions To Create A Basic Input-output System
I'm trying to use IF and AND functions to create a basic input-output system. The problem I have (more details below) is the 64 limit when the potential inputs could be infinite. For values entered into a cell between 1 and 10, this should produce an output of 0.00 in another A value higher than 10 should output as 1.00, and from then an extra 1.00 is added for every '10' added. There is no limit on the input ie 1 = 0.00, 11 = 1.00, 29 = 2.00 and so on.
View Replies!
View Related
Multiple UserForms With Multiple Numeric Data Input TextBoxes
When one creates multiple UserForms with multiple (identical) TextBoxes, every control must have its own event handler procedures. All these TextBoxes in my workbook are to capture numeric data to populate various cells in the workbook. Would you recommend using a Class Module to handle these events for TextBox controls, rather than having to repeat the event handler code for each control? And if so, do you have some code that I can use that will cover most of the events and potential error handling routines for numeric input data?
View Replies!
View Related
Use Macro To Create Dynamic Ranges
I am looking for a macro that will allow me to create a dynamic range based on the settings I give it. I would like the dynamic range to be called tracking_number and it to have a reference to =Offset(MainReport!$A$2,0,0,COUNTA(MainReport!$A:$A),1) If this is possible I would really appreciate it. The reason I need this is because I have 2 workbooks. They are the one with the MainReport in it and then the Master workbook. Every day the workbook containing the MainReport is overwritten with more data, so I can not store a dynamic range and reference it each day.
View Replies!
View Related
Create A Set Of Named Ranges
I'm trying to make my worksheet generate a bunch of named ranges whenever it is activated. However, I'm getting a "Not a valid name" error on the line in red. The value of r is a string, so I really don't see what the issue is. Another time, I got a object defined error, but I think I've declared everyhing too. That line is very similar to the line above, and tends to work once (the first time around the loop). After that, I get the errors I mentioned.
View Replies!
View Related
Create Dynamic Named Ranges With Code
I am employing code to label dynamic ranges that takes the form of, ActiveWorkbook.Names.Add Name:="dms", RefersToR1C1:="=OFFSET(DMS!R10C5,0,0, COUNTA(DMS!C5),COUNTA(DMS!R10))" 'dms_j ActiveWorkbook.Names.Add Name:="dms_j", RefersToR1C1:="=OFFSET(DMS!R11C10,0,0,MATCH("" * "",DMS!C10,-1),1)" 'dms_p ActiveWorkbook.Names.Add Name:="dms_p", RefersToR1C1:="=OFFSET(DMS!R11C16,0,0,MATCH("" * "",DMS!C16,-1),1)" 'dms_r ActiveWorkbook.Names.Add Name:="dms_r", RefersToR1C1:="=OFFSET(DMS!R11C18,0,0,MATCH("" * "",DMS!C18,-1),1)" 'dms_t ActiveWorkbook.Names.Add Name:="dms_t", RefersToR1C1:="=OFFSET(DMS!R11C20,0,0,MATCH("" * "",DMS!C20,-1),1)" The dynamic ranges are getting entered but the problem is that the range "dms" overshoots by six cells into blank cells at the bottom of the table, and the rest of the ranges overshoot by ten cells into blank cell area. I have deleted, cleared and destroyed everything around the table and re-sized the active area to no avail.
View Replies!
View Related
Create A Dynamic Array So That When A User Enters The First Sheet Name Via An Input Box
I'm trying to create a dynamic array so that when a user enters the first sheet name via an input box, excel will know to select the other sheets with ending (2), (3), (4) etc. Currently this code works only if there are 4 sheets present (as I set this way), anything lower/higher is out of range. How do I make it so that it will select sheets if there are less than 4 sheets present? I tried nesting, but I pretty sure this array needs redimming or something. Is ubound a better option?
View Replies!
View Related
Dynamically Create Named Ranges Based On Cell
I am looking for a solution to dynamically create named ranges according to the contents of cells in a particular column. The following code works for 1 word names, but in many cases the title cell contains numerous words separated by spaces. Is there a way I can adapt this code so that it will name the ranges with the spaces removed? For example, where cell C2 contains the narrative 'Sales Ledger Control', I would want the range name 'SalesLedgerControl'. Range("R2:Z2").Name = Range("C2") The named ranges are referred to in numerous other worksheets, where selecting a particular narrative from a listbox creates a dependant drop-down in the adjacent cell (eg if Sales Ledger Control is selected, the dependant list contains names of customers). FYI, the data validation in the other worksheets ignores the spaces in the range names, ie: =INDIRECT(SUBSTITUTE(G2," ","")) It would not take me long to name the ranges manually, but a macro is preferable because the narratives in the title cells will often change and the range names will obvioulsy also therefore change.
View Replies!
View Related
VBA Code To Return Multiple Found Range Objects
I read and used the Find_Range custom function provided by Aaron Blood. It's a great function, for which I have many uses, but, as I currently have it set up in conjunction with a userform, it doesn't work fully until I use it twice in a row. The first time it's used to return more than one row, it seems to stop short and only display a few of the appropriate rows. Not until it's used twice in a row does it display all the rows containing that product. What do I need to do to have it work fully each time? I have a large worksheet from which I want to extract only the rows which contain a certain product, selected by a combobox, and paste the rows on another worksheet. I have a userform set up with an oversized listbox which displays the contents of the data worksheet. Below that I have a 'products' combobox, and a button to initiate the Find_Range. Another oversized listbox displays the results. Here's the function contained in a module: Function Find_Range(Find_Item As Variant, _ Search_Range As Range, _ Optional LookIn As XlFindLookIn = xlValues, _ Optional LookAt As XlLookAt = xlPart, _ Optional MatchCase As Boolean = False) As Range Dim c As Range, FirstAddress As String With Search_Range Set c = . Find( _ What:=Find_Item, _ LookIn:=LookIn, _ LookAt:=LookAt, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=MatchCase, _ SearchFormat:=False) 'Delete this term for XL2000 and earlier If Not c Is Nothing Then Set Find_Range = c FirstAddress = c.Address................................
View Replies!
View Related
Print Multiple Ranges From Multiple Sheets Userform
I inherited a spreadsheet that had an userform where the user checked off which 'pages' he wanted to print. The Ok button routine used if statements to run a routine for each 'page.' Here's an example of the original code for one page: Sub Button2_Click() Sheet7.Activate Run "HorizontalPrintStuff" 'generic landscape pagesetup With ActiveSheet.PageSetup 'specific pageset settings .RightFooter = " Construction Assumptions" .PrintArea = "CONSTRUCTION" 'the named range to print .Zoom = False .FitToPagesTall = 1 .FitToPagesWide = 1 'this changes depending upon the page selected End With ActiveSheet.PrintOut End Sub The problem was it printed each page as a separate print job; and if you print to adobe, you get serveral files, not one file. That and it took a long time to run. So I tried a different tack. If the checkboxes has true, then the printarea is set to that named range. If there were more than one named range on a sheet to be printed, I consolidated them. I did this with a bunch of if statements - very cumbersome. Sheet3.Activate 'Sheet3.ResetAllPageBreaks 'disabled due to errors Run "HorizontalPrintStuff" 'generic landscape pagesetup With ActiveSheet.PageSetup 'specific pageset settings .PrintArea = "DEVBGTALL" 'the named range to print .FitToPagesWide = 4 'this changes depending upon the .FitToPagesTall = 1 End With I haven't shown all the code cause it goes on for 12 sheets containing 16 different printareas. My current muck ups are ..... 1) it prints every printarea/named range on a given sheet (I took out all the if statements trying to debug everything.) Is there another conditional argument that allows for multiple 'trues'? 2) the pagebreaks in printarea/named ranges that are multiple pages (like a 48 month schedule) won't stay set. I've tried both VPageBreaks(3).Location:= and .VPageBreaks.Add Before:= 3) the Sheet1.select false argument is always adding a random sheet to the end of the print job. Don't know why. I can do all this in a recorded macro, just not the selection userform. I've thought about copying to another sheet or hiding columns and rows then printing, but that seems just as cumbersome. To recap, i want to print out, as one print job, multiple printareas from mulitple sheets, based upon checkbox selection on an userform.
View Replies!
View Related
Multiple Parameter Lookup For Multiple Table Ranges
In the attached file i have multiple tables for different types of conservatory roofs (16 of them in total). The ranges at the top and side relate to milimeter measurements and the data in the middle relate to the price for that sized conservatory roof. The table works where the two ranges intercept each other. I have a formula to do this for one of the tables only. What i would like is a way of choosing which type of roof to use (i.e. which table to use) and then to be able to input the measurements and the price to be displayed. All of this needs to be done in one query so its as user friendly as possible. i've had is to use a pivot table, i feel it is not possible to use a pivot table to do this sort if thing after research into them, although i am un-familiar in the making of them
View Replies!
View Related
Macro To Create Named Ranges Based On A Header Row.
I need a macro that can set up some named ranges using the text in the header row and the sheet name. The header row will always be in row one, but the number of columns will be dynamic. The amount of rows in the range will need to be dynamic also. To clarify, every used cell stating in row 2 in a column will be the named range with the sheetname+text in row one of the column the actual name.
View Replies!
View Related
Macro: Create Named Ranges. Unknown Columns/Rows
I need to make named ranges from an unknown number of columns(at least 1) each with an unknown number of rows. Each column has the name of the named range as the first row, and then a variable number of rows containing part numbers. I can do it 1 by 1, but id rather do it in a loop so that blanks dont cause errors. there will be different people using versions of this sheet with different model/part number information What i've tried: Count number of colums with row 1 containing data (11 max, which is more than will ever be used) add into array(I know i dont really need to add into the array, but i might use it later for some other code). The problem i'm having is finding the range of rows that need added to the named dynamic range and adding it. modelcount = Range("G7") 'G7 (for now) contains =COUNTA(H1,I1,J1,etc) For i = 1 To modelcount Redim Preserve Models(0 To i) Models(i) = Cells(1, i + 7) Range1 = Cells(2, i + 7).Address(xlA1) lastRow = Cells(rows.Count, i + 7).End(xlUp).Row Range2 = Cells(lastRow, i + 7).Address(xlA1) Reference = Cells(2, i + 7).Address(xlA1) ThisWorkbook.Names.Add Name:=Models(i), _ RefersTo:="=OFFSET(Reference,0,0,counta(Range1:Range2),1)", Visible:=True Next i This gets me the range i need, but doesnt create the named range properly. If i go to insert>names>define, the named ranges are created, but they dont relate to the data in any columns. It shows the variable names rather than the cell range the variable represents.
View Replies!
View Related
Create User Settable Print Area With Dynamic Ranges
Once a user of my workbook has input various price levels on the Input Page, the data is sorted on the output page. As the data on the Output Page is quite vast and not all of it is relevant on a particular day, the user is interested in just printing a certain range of data that are in 5 columns. I am trying to figure out how to set up a macro that will allow the user to enter into an Input Box the range to print (ie. Cells C25:G60). I found one example on this site listed below that allows one to do that but I would like to make it more user friendly. I do not want to make the user have to write out Excel cooridinates. Specifically by allowing the user to input in the Input Box a High price level in Column C and a Low Price level in Column C ; The macro will look in Column C for the highest instance of this High Price and begin the range down to the last instance of the Low Price (there can be several instances of the exact price level.) The macro would then create the print preview of the cells Cxx:Gyy. Sub SelectPrintArea() Dim PrintThis As Range ActiveSheet.PageSetup.PrintArea = "" Set PrintThis = Application.InputBox _ (Prompt:="Select the Print Range", Title:="Select", Type:=8) PrintThis.Select Selection.Name = "NewPrint" ActiveSheet.PageSetup.PrintArea = "NewPrint" ActiveSheet.PrintPreview End Sub
View Replies!
View Related
|