Search Results

Search found 4783 results on 192 pages for 'excel vba'.

Page 66/192 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • Merge Multple Worksheets From Multple Workbooks

    - by Droter
    Hi, I have found multiple posts on merging data but I am still running into some problems. I have multiple files with multiple sheets. Example 2007-01.xls...2007-12.xls in each of these files are daily data on sheets labeled 01, 02, 03 ..... There are other sheets in the file so I can't just loop through all worksheets. I need to combine the daily data into monthly data, then all of the monthly data points into yearly. On the monthly data I need it to be added to the bottom of the page. I have added the file open changes for Excel 2007 Here is what I have so far: Sub RunCodeOnAllXLSFiles() Dim lCount As Long Dim wbResults As Workbook Dim wbMaster As Workbook Application. ScreenUpdating = False Application.DisplayAlerts = False Application.EnableEvents = False On Error Resume Next Set wbMaster = ThisWorkbook Dim oWbk As Workbook Dim sFil As String Dim sPath As String sPath = "C:\Users\test\" 'location of files ChDir sPath sFil = Dir("*.xls") 'change or add formats Do While sFil <> "" 'will start LOOP until all files in folder sPath have been looped through Set oWbk = Workbooks.Open(sPath & "\" & sFil) 'opens the file Set oWbk = Workbooks.Open(sPath & "\" & sFil) Sheets("01").Select ' HARD CODED FIRST DAY Range("B6:F101").Select 'AREA I NEED TO COPY Range("B6:F101").Copy wbMaster.Activate Workbooks("wbMaster").ActiveSheet.Range("B65536").End(xlUp)(2).PasteSpecial Paste:=xlValues Application.CutCopyMode = False oWbk.Close True 'close the workbook, saving changes sFil = Dir Loop ' End of LOOP On Error Goto 0 Application.ScreenUpdating = True Application.DisplayAlerts = True Application.EnableEvents = True End Sub Right now it can find the files and open them up and get to the right worksheet but when it tries to copy the data nothing is copied over. Thanks for your help, Matt

    Read the article

  • Function returning a class containing a function returning a class

    - by Scott
    I'm working on an object-oriented Excel add-in to retrieve information from our ERP system's database. Here is an example of a function call: itemDescription = Macola.Item("12345").Description Macola is an instance of a class which takes care of database access. Item() is a function of the Macola class which returns an instance of an ItemMaster class. Description() is a function of the ItemMaster class. This is all working correctly. Items can be be stored in more than one location, so my next step is to do this: quantityOnHand = Macola.Item("12345").Location("A1").QuantityOnHand Location() is a function of the ItemMaster class which returns an instance of the ItemLocation class (well, in theory anyway). QuantityOnHand() is a function of the ItemLocation class. But for some reason, the ItemLocation class is not even being intialized. Public Function Location(inventoryLocation As String) As ItemLocation Set Location = New ItemLocation Location.Item = item_no Location.Code = inventoryLocation End Function In the above sample, the variable item_no is a member variable of the ItemMaster class. Oddly enough, I can successfully instantiate the ItemLocation class outside of the ItemMaster class in a non-class module. Dim test As New ItemLocation test.Item = "12345" test.Code = "A1" quantityOnHand = test.QuantityOnHand Is there some way to make this work the way I want? I'm trying to keep the API as simple as possible. So that it only takes one line of code to retrieve a value.

    Read the article

  • Create a named cell dynamically

    - by CaptMorgan
    I have a workbook with 3 worksheets. 1 worksheet will have input values (not created at the moment and not needed for this question), 1 worksheet with several "template" or "source" tables, and the last worksheet has 4 formatted "target" tables (empty or not doesn't matter). Each template table has 3 columns, 1 column identifying what the values are for in the second 2 columns. The value columns have formulas in them and each cell is Named. The formulas use the cell Names rather than cell address (e.g. MyData1 instead of C2). I am trying to copy the templates into the target tables while also either copying the cell Names from the source into the targets or create the Names in the target tables based on the source cell Names. My code below I am creating the target names by using a "base" in the Name that will be changed depending on which target table it gets copied to. my sample tables have "Num0_" for a base in all the cell names (e.g. Num0_MyData1, Num0_SomeOtherData2, etc). Once the copy has completed the code will then name the cells by looking at the target Names (and address), replacing the base of the name with a new base, just adding a number of which target table it goes to, and replacing the sheet name in the address. Here's where I need help. The way I am changing that address will only work if my template and target are using the same cell addresses of their perspective sheets. Which they are not. (e.g. Template1 table has value cells, each named, of B2 thru C10, and my target table for the copy may be F52 thur G60). Bottom line I need to figure out how to copy those names over with the templates or name the cells dynamically by doing something like a replace where I am incrementing the address value based on my target table #...remember I have 4 target tables which are static, I will only copy to those areas. I am a newbie to vba so any suggestions or help is appreciated. NOTE: The copying of the table works as I want. It even names the cells (if the Template and Target Table have the same local worksheet cell address (e.g. C2) 'Declare Module level variables 'Variables for target tables are defined in sub's for each target table. Dim cellName As Name Dim newName As String Dim newAddress As String Dim newSheetVar Dim oldSheetVar Dim oldNameVar Dim srcTable1 Sub copyTables() newSheetVar = "TestSheet" oldSheetVar = "Templates" oldNameVar = "Num0_" srcTable1 = "TestTableTemplate" 'Call sub functions to copy tables, name cells and update functions. copySrc1Table copySrc2Table End Sub '****there is another sub identical to this one below for copySrc2Table. Sub copySrc1Table() newNameVar = "Num1_" trgTable1 = "SourceEnvTable1" Sheets(oldSheetVar).Select Range(srcTable1).Select Selection.Copy For Each cellName In ActiveWorkbook.Names 'Find all names with common value If cellName.Name Like oldNameVar & "*" Then 'Replace the common value with the update value you need newName = Replace(cellName.Name, oldNameVar, newNameVar) newAddress = Replace(cellName.RefersTo, oldSheetVar, newSheetVar) 'Edit the name of the name. This will change any formulas using this name as well ActiveWorkbook.Names.Add Name:=newName, RefersTo:=newAddress End If Next cellName Sheets(newSheetVar).Select Range(trgTable1).Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False End Sub PING

    Read the article

  • How do I repeat function over several row.

    - by ChrisBD
    I'll admit that I'm not an Excel guru so maybe someone here can help me. On my worksheet I have several blocks of data. I calculate the sum of all items within column D of that block. Within each block I am checking the value of the cell in column C and if it contains the letter "y" and the value in column D of that row is equal to zero I must exclude the total sum of column D. Currently I am doing this by multiplying the sum value by either 1 or 0 which is produced by running a test over the cell contents. Below is an example of what I am using to test rows 23 to row 25 inclusively for data in Column D. I am also performing the same on Column E and G, but the "y" character is always in column C, hence the absolut column reference. =IF(AND($C23="y",D23=0),0,1)*IF(AND($C24="y",D24=0),0,1)*IF(AND($C25="y",D25=0),0,1) There must be a more efficient way to do this. Ideally I would like to write a function that I can paste into a cell and then select the rows or cells over which I run the test. Can anyone point me in the right direction?

    Read the article

  • update record only works when there is no auto_increment

    - by every_answer_gets_a_point
    i am accessing a mysql table through an odbc connection in excel here is how i am updating the table: With rs .AddNew ' create a new record ' add values to each field in the record .Fields("datapath") = dpath .Fields("analysistime") = atime .Fields("reporttime") = rtime .Fields("lastcalib") = lcalib .Fields("analystname") = aname .Fields("reportname") = rname .Fields("batchstate") = "bstate" .Fields("instrument") = "NA" .Update ' stores the new record End With when the schema of the table is this, updating it works: create table batchinfo(datapath text,analysistime text,reporttime text,lastcalib text,analystname text, reportname text, batchstate text, instrument text); but when i have auto_increment in there it does not work: CREATE TABLE batchinfo ( rowid int(11) NOT NULL AUTO_INCREMENT, datapath text, analysistime text, reporttime text, lastcalib text, analystname text, reportname text, batchstate text, instrument text, PRIMARY KEY (rowid) ) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=latin1 has anyone experienced a problem like this where updating does not work when there is an auto_increment field involved? connection string: Private Sub ConnectDB() Set oConn = New ADODB.Connection oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _ "SERVER=localhost;" & _ "DATABASE=employees;" & _ "USER=root;" & _ "PASSWORD=pas;" & _ "Option=3" End Sub also here's the rs.open: rs.Open "batchinfo", oConn, adOpenKeyset, adLockOptimistic, adCmdTable

    Read the article

  • Excel 2007 and Unicode

    - by pjlasl
    I have an israeli spreadsheet reading right to left. When I read the values (using VBA) it places a question mark (?) at the beginning and end of the text, in other words it wraps the text with the question mark (ie ?0123456?). If you type Range("A2").value or .value2 or .text the results are the same. Any idea on how to prevent this?

    Read the article

  • Conditional Formatting in Excel

    - by littlevahn
    I'm very new to Excel and VBA and was wondering if there is a way I could make conditional formatting based on values in a drop down list. I currently have a warning if the user enters something that is not valid (data validation), but I want to change the cell's background color to red if invalid, or green if valid. Again the options I want to test against are in a Listbox.

    Read the article

  • Conditional Formating in Excel

    - by littlevahn
    HI, Im very new to Excel and VBA and was wondering I there is a way I could make conditional formatting on drop down Lists. I currently have a warning if the user enters something that is not valid (data validation) but I want to change the cell's background color to red if invalid or green if valid. Again there only options are in a List box. Any help would be awesome. Thanks

    Read the article

  • Excel Merge() vs MergeCells

    - by sleepp
    Hi, I'm using VSTO, C#, and Excel but VBA probably applies here as well. What's the difference between calling the Merge(missing) method on a range and setting the MergeCells property to true? Does Merge() fail more often? Thanks!

    Read the article

  • I want to move columns in a gradebook based on the column header title to another gradebook

    - by Pat
    I have to average grades based on each objective for a new report card we have to complete this year. For example Column one has students names, each additional column will have the objective associated with the assignment. I would like to move the entire column to another sheet for each objective. Is there a formula or macro that will do that. For example objective 3.1A is in columns 2, 5, and 7, objective 3.2B is located in columns 1, 4, 10, and 12, objective 3.4c is in column 3, 6, 9, and 11. I would like to have a spreadsheet for each objective.

    Read the article

  • Printing a dynamic sheet as one document

    - by Sux2Lose
    I have a spreadsheet structured as follows: Summary section at the top Detail section on the bottom Summary section summarizes the detail section which is filtered using auto filters There are ten products that all need to be printed individually, but I want the page footer to show the overall page position of all the print jobs and the total number of pages. That is probably not clear. So for example, if I print the two page Product A view it will print page 1 of 2 and 2 of 2. If I print the one page Product B it will show page 1 of 1. What I want is to print both and have Product A show Page 1 of 3, Page 2 of 3, and Product B be Page 3 of 3. Is there any way to accomplish this?

    Read the article

  • How to count the most recent value based on multiple criteria?

    - by Andrew
    I keep a log of phone calls like the following where the F column is LVM = Left Voice Mail, U = Unsuccessful, S = Successful. A1 1 B1 Smith C1 John D1 11/21/2012 E1 8:00 AM F1 LVM A2 2 B2 Smith C2 John D2 11/22/2012 E1 8:15 AM F2 U A3 3 B3 Harvey C3 Luke D3 11/22/2012 E1 8:30 AM F3 S A4 4 B4 Smith C4 John D4 11/22/2012 E1 9:00 AM F4 S A5 5 B5 Smith C5 John D5 11/23/2012 E5 8:00 AM F5 LVM This is a small sample. I actually have over 700 entries. In my line of work, it is important to know how many unsuccessful (LVM or U) calls I have made since the last Successful one (S). Since values in the F column can repeat, I need to take into consideration both the B and C column. Also, since I can make a successful call with a client and then be trying to contact them again, I need to be able to count from the last successful call. My G column is completely open which is where I would like to put a running total for each client (G5 would = 1 ideally while G4 = 0, G3 = 0, G2 = 2, G1 = 1 but I want these values calculated automatically so that I do not have scroll through 700 names).

    Read the article

  • How to convert a string to a binary, then hex, value?

    - by Wuschelbeutel Kartoffelhuhn
    In one column I have a bitstring encoded as a string type. In a different column I wish to have the same bits (potentially starting with a leading 0), but as a binary value type. Ultimately, I want to have it in hex representation (string or hex type, doesn't matter) in a third column. How is this done? Do I have to program something for it or is there a faster way? Input cell contains the following string: 00000100100011000100100011 I wish to obtain the string: 0123123

    Read the article

  • Pivot tables: How can I total the subtotal?

    - by Mike
    Person A needs £115, Person D £234 and Person G £789, but how do I SUM that and get it to show on the same ROW as the subtotal? The Rows are subscription names. The Value field holds the Cost per subscription. the Columns holds the name of the person who receives the subscription. I have GROUPED on YEAR & MONTH, and have a subtotal that shows me how much each person will need to pay each month for all their subscriptions, but I need a figure showing me the total of all the subscriptions per month. I've tried adding calculated fields, but I want to SUM the subtotals so I'm struggling to see the field I need to use. I've tried Grand Totals but that SUMS all rows and I really only want SUM the Subtotal Total Row. I need a nice neat report that my managers won't go white at when looking at it...to many numbers = fear and confusion. Anyway it got messy, so I've come for help. Cheers Mike.

    Read the article

  • How can I sort my data while keeping paired rows together?

    - by Joe Lee Frank
    How can I pair two rows on a spreadsheet, so that for each data entry I can sort the matrix but the pair of rows moves as a single list of data, retaining the structure of the two rows? For example: Original entry A1,1 B1,1 C1,1 D1,1 A1,2 B1,2 C1,2 D1,2 A2,1 B2,1 C2,1 D2,1 A2,2 B2,2 C2,2 D2,2 Sorted reverse order A2,1 B2,1 C2,1 D2,1 A2,2 B2,2 C2,2 D2,2 A1,1 B1,1 C1,1 D1,1 A1,2 B1,2 C1,2 D1,2

    Read the article

  • Adding value of cell X only if cell Y is blank

    - by Graeme Hutchison
    I have a list with three columns A, B, and C. The first two columns are complete (A and B), while the third (C) has many blanked fields. What I want to do is replace all the blank fields in Column C with the same value form cell A in the same row. The List contains over 2000 records, of which 65% have a blank Column C value, so I would like to use a formula/function. Below is an example of what I have and what I want to do (on a much smaller scale)

    Read the article

  • Excel - convert groupped data into PivotTable - is it possible?

    - by zmische
    I have report in Excel format (Excel 2007) from Accountant department - and it has Groupping by Rows. + Client 1 300$ (group Bills by Client) |-- BIll 1 100$ |-- Bill 2 200$ So in Excel It looks like this in plain rows format (If I ungroup those rows): 1 Client1 300$ 2 Bill1 100$ 3 Bill2 200$ 1,2,3 - row numbers. So I cant Pivot these data to get Client-by-Bill-SUm report, because rows with Client Name are not Connected (that is necessary for Pivoting info by Client, Bills) with Bills rows after UnGroupping.

    Read the article

  • How to change a function/formula in a whole column where I also have empty cells

    - by Zvi
    I have a column with a formula/function that has other cells as parameters. However in the column, every few rows I have a subtotal and blanks, for readability. Now I decided to change the formula/function but I can not do copy+paste on the whole column because of the subtotals/blank cells, and I can not do change+replace because there are parameters in the functions that uses other cells and thus it is different in each cell in the column. For example, if the formula is =if(A5>24,1,"") and I want to change it to =AA_userfn(A5,B5) Any idea how to change it easily? currently I copy+paste few rows at a time, but that is tedious. Maybe a Sub that will go all over the column (the column number as an input parameter) and looks for =if(, and then replaces it with =aa_userfn(Ax, By) where Ax and By are calculated based on the position of the cell currently changed in reference to the previous values in that cell. Any ideas will be welcomed

    Read the article

  • How do I keep Conditional Formatting formulas and ranges from automatically changing?

    - by Iszi
    I've found that Conditional Formatting formulas and ranges will automatically adjust when you copy, delete, or move data around in a spreadsheet. While this is a nice idea, it tends to break things for me in some rather weird ways. To avoid this, I tried writing rules that applied to the entire spreadsheet and keyed off of column headers to highlight the data I wanted to check. Example: =AND(A$1="Check This Column For Blanks),ISBLANK(A1)) applied to =$1:$1048576 However, even with the rule explicitly applied to the entire sheet, it was still automatically adjusting (and breaking in weird ways by doing so) as I worked in the sheet. How can I avoid this?

    Read the article

  • Divide pivot table data by an arbitrary column in another table

    - by rsavu
    Hello all, I have this data from a pivot table: Countries P1 P2 Total Country 1 10 69 Country 2 36 2 92 Country 3 21 24 100 Country 4 22 77 Country 5 13 79 Country 6 12 1 48 Country 7 14 29 Country 8 22 1 46 Country 9 4 1 31 Country 10 16 7 120 Country 11 25 2 114 Country 12 8 11 68 Country 13 5 27 Country 14 11 3 23 Country 15 6 19 Country 16 33 79 Where: 1st column is the country name 2nd and 3rd column are the tickets introduced in the system 4th column is the total (disregard the data - total is not accurate) Additionally, I have another table that looks like this: Country P1 P2 Country 1 2 3 Country 2 2 2 Country 3 0 2 Country 4 0 3 Country 5 1 1 Country 6 2 2 Country 7 1 2 Country 8 3 3 Country 9 1 4 Country 10 2 1 Country 11 4 2 Country 12 2 1 Country 13 3 2 Country 14 3 3 Country 15 1 2 Country 16 2 2 Where the data represents the number of users of the application in each country. I want to be able to show the number of tickets submitted divided by the number of users in each country. Any ideeas how to do that? Thank you very much, Razvan

    Read the article

  • How to copy a cell's formatting using a formula?

    - by Alvin Lim
    For example, cell A1 contains the text "Hello World" which is in bold. In cell A2, I use the formula =A1. Therefore cell A2 now also contains "Hello World", but it is not in bold. How can I modify the formula to also copy the formatting (in this case, bold) of A1? A more complex example is strikethrough properties, i.e. A1 contains "Orange/Red". How do I show the same content in cell A2 dynamically, so that any changes made in A1 will update A2 as well?

    Read the article

  • Populating cells with data from another spreadsheet after just keying in a few letters

    - by Wendy Griffin
    I have 1 workbook with 2 spreadsheets. Spreadsheet 2 column A contains a long list of company names, Columns B - H contain critical information about the company. Spreadsheet 1 contains all of the columns as Spreadsheet 2 plus some other columns. What I'm trying to achieve is that when you start to type in the first 3 characters of a company name on Spreadsheet 1 it would then have a drop down of the companies (as listed on Spreadsheet 2) that share the first 3-5 letters and you would select one. Upon selecting a company name all of the corresponding company information would populate in the other columns on spreadsheet 1 automatically. This is to avoid copying a row from Spreadsheet 2 and pasting it in Spreadsheet 1. Any help with this would be greatly appreciated. Cheers!

    Read the article

  • Set a formula on many cells with minimal manual edits

    - by makerofthings7
    I need to set the following formula on many cells: =VLOOKUP(MAX(Historical!$A$5:$FZ$99999),Historical!$A$5:$FZ$99999,7,1) This formula looks up the most recent date in the History table, and returns the value specified. Here I'm returning column 7. How can I paste the cells and auto increment the value where "7" is. In other words I need to paste that summary formula on several hundred cells and change the number 7 for each.

    Read the article

  • Positive result, negative result and current balance. How do you make starting balance show current result?

    - by Tine
    I have 3 columns. Column A shows positive result and if the result is negative then it is in a column B. Column B shows negative result and if the result is positive then it is in a column A. (meaning that either columns can have 0.00 in the cell (empty zero cells)). Column C has starting assets and it also shows the current balance that while result A or B are adding up and current balance is showing the current result. What is the proper formula for this I hope I was clear with my problem. Please help. Thanks in advance!

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >