Search Results

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

Page 9/192 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Copy first row in excel workbook to a new excel workbook

    - by user1667414
    How do I get the first row in an excel workbook & save it to a new excel workbook using .net c#? I dont know the amount of columns so need to get entire row. This what I have but the new workbook is blank (no row copied) Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(file); Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1]; Excel.Range xlRangeHeader = xlWorksheet.get_Range("A1", "A1").EntireRow; Excel.Workbook xlWorkbookNew = xlApp.Workbooks.Add(); Excel._Worksheet xlWorksheetNew = xlWorkbookNew.Sheets[1]; xlWorksheetNew.get_Range("A1", "A1").EntireRow.Value = xlRangeHeader; xlWorkbook.Close(false); xlWorkbookNew.SaveAs(Path.Combine(sDestination, Path.GetFileName(file)), fileFormat); xlWorkbookNew.Close(true);

    Read the article

  • Excel: conditionally format a cell using the format of another, content-matching cell

    - by Eric A. Meyer
    I have an Excel spreadsheet where I’d like to be able to create a “key” of formatted cells with unique values, and then in another sheet format cells using the key formatting. So for example, my key is as follows, with one value per cell and the visual formatting indicated in parentheses: A (red background) B (green background) C (blue background) So that’s on one sheet (or in a remote corner of the current sheet—whichever is better). Then, in an area that I mark for conditional formatting, I can type one of those three letters and have the cell where I typed it visually formatted according to the key. So if I type a “B” into one of the conditionally formatted cells, it gets a green background. (Note that I’m using backgrounds here solely for ease of explanation: ideally I want to have all visual formatting copied over, whether it’s foreground color, background color, font weight, borders, or whatever. But I’ll take what I can get, obviously.) And—just to make it extra-tricky—if I change the formatting in the key, that change should be reflected in cells that reference the key. Thus, if I change the “B” formatting in the key from a green background to a purple background, any “B” in the main sheet should switch to the new color. Similarly, it should be possible to add or remove values from the key and have those changes applied to the main data set. I’m okay with the formatting-update-on-key-change being triggered by clicking a button or something. I suspect that if any of this is possible it will require VBA, but I’ve never used it so I’ve no idea where to start if that’s the case. I’m hoping it’s possible without VBA. I know it’s possible to just use multiple conditional formats, but my use case here is that I’m trying to create the above-described capability for someone who isn’t conversant with conditional formatting. I’d like to let them be able to define a key, update it if necessary, and keep on truckin’ without me having to rewrite the spreadsheet’s formatting rules for them. --- UPDATE --- So I think I was a bit unclear about my original request. Let me try again with an image. The image shows the “key” on the left, where values and styles are defined using keyboard and mouse input. On the right, you see the data that should be formatted to match the key. Thus if I type a “C” into a cell in the Data area, it should be blue-backed. Furthermore, if I change the formatting of “C” in the Key to have a purple background, all the “C” cells should switch from blue to purple. For further craziness, if I add more to the Key (say, “D” with a yellow background) then any “D” cells will be styled to match; if I remove a Key entry, then matching values in the Data area should revert to default styling. So. Is that more clear? Is it possible, in whole or in part? I don’t have to use conditional formatting for this; in fact, at this point I suspect I probably shouldn’t. But I’m open to any approach!

    Read the article

  • Excel 'recently used list' not showing on start menu, but working within excel

    - by Margaret Thorpe
    In windows 7 when you pin Excel 2007 to the start menu, it usually has a small arrow which shows your recently opened documents. Mine only shows permanently pinned documents. It used to work until I tried Office 2010 and then uninstalled it. If I open Excel and click on the file menu, I can see all the recently opened documents so they are being recorded somewhere... Any idea on how to restore it so I can view them on the start menu - Which I always used before?

    Read the article

  • Excel: Cell Value as Excel Document Metadata Property

    - by mjlefevre
    I know you can add custom Document Properties in Excel 2007. see: http://office.microsoft.com/en-us/excel/HA100475241033.aspx#5 But I thought there was a way to pull a value from a cell as a custom metadata property without code. Maybe I'm searching for it with the wrong terminology. Maybe it has to be done as a Named Range. I know this can be done. Anyone know how?

    Read the article

  • Excel macro to delete empty rows isn't stopping

    - by RocketGoal
    How do I make it stop after a certain amount of rows? I've taken a VBA course and my teacher explained how to delete empty rows. I'm now trying to put this in place but my macro isn't stopping. I thought I had limited it to 200 rows. I'm missing something important. Any pointers much appreciated. Sub RemoveRows() ' Remove rows from last blank cell Dim LastRow As Long Dim ISEmpty As Long 'Count how many records in the list. This is done so that the Do loop has a finish point. LastRow = Range("A200").End(xlUp).Row 'Start at the top of the list Range("A1").Select 'Loop until the end of the list Do While ActiveCell.Row < LastRow 'Assign number of non empty cells in the row ISEmpty = Application.CountA(ActiveCell.EntireRow) 'If ISEmpty = 0 then delete the row, if not move down a cell into the next row If ISEmpty = 0 Then ActiveCell.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If Loop End Sub

    Read the article

  • Unable to diligently close the excel process running in memory

    - by NewAutoUser
    I have developed a VB.Net code for retrieving data from excel file .I load this data in one form and update it back in excel after making necessary modifications in data. This complete flow works fine but most of the times I have observed that even if I close the form; the already loaded excel process does not get closed properly. I tried all possible ways to close it but could not be able to resolve the issue. Find below code which I am using for connecting to excel and let me know if any other approach I may need to follow to resolve this issue. Note: I do not want to kill the excel process as it will kill other instances of the excel Dim connectionString As String connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & ExcelFilePath & "; Extended Properties=excel 8.0; Persist Security Info=False" excelSheetConnection = New ADODB.Connection If excelSheetConnection.State = 1 Then excelSheetConnection.Close() excelSheetConnection.Open(connectionString) objRsExcelSheet = New ADODB.Recordset If objRsExcelSheet.State = 1 Then objRsExcelSheet.Close() Try If TestID = "" Then objRsExcelSheet.Open("Select * from [" & ActiveSheet & "$]", excelSheetConnection, 1, 1) Else objRsExcelSheet.Open("Select Test_ID,Test_Description,Expected_Result,Type,UI_Element,Action,Data,Risk from [" & ActiveSheet & "$] WHERE TEST_Id LIKE '" & TestID & ".%'", excelSheetConnection, 1, 1) End If getExcelData = objRsExcelSheet Catch errObj As System.Runtime.InteropServices.COMException MsgBox(errObj.Message, , errObj.Source) Return Nothing End Try excelSheetConnection = Nothing objRsExcelSheet = Nothing

    Read the article

  • Excel 2007 | Remove blank fields from pivot tables

    - by answertips
    Every time I create a pivot table (available for all Excel versions) I get one or several blank fields. How can I get rid of them? One workaround I used was to select the blank field, right click | Filter | Hide Selected Items. This can solve my problem but I need to do it manually... Is there a way to automatically hide/exclude the blanks?

    Read the article

  • Excel formula to compare single value in one cell with multiple values in other cell

    - by Raw
    I have a value in Column A, which I want to compare with multiple values of corresponding cell in column B, and depending on that value, put the answer in column C. For example, using the table below, it searching in column B for values which are less than or equal to 12 and put the answer in same order in column C. Column A Column B Column C 12 0,12,13,14 Yes, Yes, No, No 101 101,102,103,104 Yes, No, No, No How can I do this in Excel?

    Read the article

  • How to Use Sparklines in Excel 2010

    - by DigitalGeekery
    One of the cool features of Excel 2010 is the addition of Sparklines. A Sparkline is basically a little chart displayed in a cell representing your selected data set that allows you to quickly and easily spot trends at a glance. Inserting Sparklines on your Spreadsheet You will find the Sparklines group located on the Insert tab.   Select the cell or cells where you wish to display your Sparklines. Select the type of Sparkline you’d like to add to your spreadsheet. You’ll notice there are three types of Sparklines, Line, Column, and Win/Loss. We’ll select Line for our example. A Create Sparklines pops up and will prompt you to enter a Data Range you are using to create the Sparklines. You’ll notice that the location range (the range where the Sparklines will appear) is already filled in. You can type in the data range manually, or click and drag with your mouse across to select the data range. This will auto-fill the data range for you. Click OK when you are finished.   You will see your Sparklines appear in the desired cells.   Customizing Sparklines Select the one of more of the Sparklines to reveal the Design tab. You can display certain value points like high and low points, negative points, and first and last points by selecting the corresponding options from the Show group. You can also mark all value points by selecting  Markers. Select your desired Sparklines and click one of the included styles from the Style group on the Design tab. Click the down arrow on the lower right corner of the box to display additional pre-defined styles…   or select Sparkline Color or Marker Color options to fully customize your Sparklines. The Axis options allow additional options such as Date Axis Type, Plotting Data Left to Right, and displaying an axis point to represent the zero line in your data with Show Axis. Column Sparklines Column Sparklines display your data in individual columns as opposed to the Line view we’ve been using for our examples. Win/Loss Sparklines Win/Loss shows a basic positive or negative representation of your data set.   You can easily switch between different Sparkline types by simply selecting the current cells (individually or the entire group), and then clicking the desired type on the Design tab. For those that may be more visually oriented, Sparklines can be a wonderful addition to any spreadsheet. Are you just getting started with Office 2010? Check out some of our other great Excel posts such as how to copy worksheets, print only selected areas of a spreadsheet, and how to share data with Excel in Office 2010. Similar Articles Productive Geek Tips Convert a Row to a Column in Excel the Easy WayShare Access Data with Excel in Office 2010Make Excel 2007 Print Gridlines In Workbook FileMake Excel 2007 Always Save in Excel 2003 FormatConvert Older Excel Documents to Excel 2007 Format TouchFreeze Alternative in AutoHotkey The Icy Undertow Desktop Windows Home Server – Backup to LAN The Clear & Clean Desktop Use This Bookmarklet to Easily Get Albums Use AutoHotkey to Assign a Hotkey to a Specific Window Latest Software Reviews Tinyhacker Random Tips DVDFab 6 Revo Uninstaller Pro Registry Mechanic 9 for Windows PC Tools Internet Security Suite 2010 Office 2010 reviewed in depth by Ed Bott FoxClocks adds World Times in your Statusbar (Firefox) Have Fun Editing Photo Editing with Citrify Outlook Connector Upgrade Error Gadfly is a cool Twitter/Silverlight app Enable DreamScene in Windows 7

    Read the article

  • Remove Excel data link in Visio Drawing

    - by Ddono25
    I am creating a server topology for one of our SharePoint farms and thought it would be easy to just link the Excel spreadsheet with our server information to the Visio drawing to auto-populate some things. It didn't work out that well, but the drawing is finished without it now. I cannot remove the link between the Excel spreadsheet and the Visio diagram. Whenever the drawing is opened the linked excel server list opens in a pane at the very bottom of the window. How would I eliminate the data link? Or just the spreadsheet from view when being opened?

    Read the article

  • Excel removing leading leading zeros when displaying CSV data

    - by Velika Kudac
    I have a CSV text file with the following content: "Col1","Col2" "01",A "2",B "10", C When I open it up with Excel, it displays as shown here: Note that Cell 2A attempts to display "01" as a number without a leading 0. When I format rows 2 through 4 as "Text", it changes the display to ...but still the leading "0" is gone. Is there a way to open up a CSV file in XLS and be able to see all of the leading zeros in the file by flipping some option? I do not want to have to retype '01 in every cell that should have a leading zero. Furthermore, using a leading apostrophe necessitates that the changes be saved to a XLS format when CSV is desired. My goal is simply to use Excel to view the actual content of the file as text without Excel trying to do me any formatting favors.

    Read the article

  • How to Merge Data From Multiple Excel Files into a Single Excel File or Access Database?

    - by lalabeans
    I have a few dozen excel files which are all of the same format (i.e. 4 worksheets per Excel file). I need to combine all the files into 1 master file which must have just 2 of the 4 worksheets. The corresponding worksheets from each Excel file are named exactly the same as are the column headers. While each file is structured the same, the information within sheet 1 and 2 (for example) is different. So it can’t be combined into one file with everything in one sheet! I've never used VBA before and I'm wondering where I might start this task!

    Read the article

  • Auto create folders using Excel field entries

    - by prrao
    I need to generate folders containing certain Excel field entries: Additionally, I need to append a date to the folder name based on that entry So If I have the above Excel table, I'd need the following set of folders to be generated in the same directory: Is this possible using a macro? Also, in case I add another entry how would I generate another folder only for that entry; for example I add another project CWO-1106: Basically, I'd like to keep updating the Excel sheet and create folders only for the new entries Any help would be appreciated. Thanks!

    Read the article

  • Excel fonts: Embedding or fallback options?

    - by Brendan
    I'm working with making a form in Excel instead of Illustrator or InDesign, as I typically do. One of the benefits about working with Adobe (and the subsequent PDFs) is that I control the fonts 100%. This is not the case when I am required to work with an Excel file that'll be passed around. So, is there a way to embed fonts? I'd like to embed Calibri. If not, is there a way to specify a fallback font, such as Tahoma? My thinking is along the lines of a CSS font stack; not sure if there's anything like that in Excel.

    Read the article

  • Automation Error upon running VBA script in Excel

    - by brohjoe
    Hi guys, I'm getting an Automation error upon running VBA code in Excel 2007. I'm attempting to connect to a remote SQL Server DB and load data to from Excel to SQL Server. The error I get is, "Run-time error '-2147217843(80040e4d)': Automation error". I checked out the MSDN site and it suggested that this may be due to a bug associated with the sqloledb provider and one way to mitigate this is to use ODBC. Well I changed the connection string to reflect ODBC provider and associated parameters and I'm still getting the same error. Here is the code with ODBC as the provider: Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Dim stSQL As String Dim wbBook As Workbook Dim wsSheet As Worksheet Dim rnStart As Range Public Sub loadData() 'This was set up using Microsoft ActiveX Data Components version 6.0. 'Create ADODB connection object, open connection and construct the connection string object. Set cnt = New ADODB.Connection cnt.ConnectionString = _ "Driver={SQL Server}; Server=onlineSQLServer2010.foo.com; Database=fooDB Uid=logonalready;Pwd='helpmeOB1';" cnt.Open On Error GoTo ErrorHandler 'Open Excel and run query to export data to SQL Server. strSQL = "SELECT * INTO SalesOrders FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0', & _ "'Data Source=C:\Database.xlsx; Extended Properties=Excel 12.0')...[SalesOrders$]" cnt.Execute (strSQL) 'Error handling. ErrorExit: 'Reclaim memory from the connection objects Set rst = Nothing Set cnt = Nothing Exit Sub ErrorHandler: MsgBox Err.Description, vbCritical Resume ErrorExit 'clean up and reclaim memory resources. cnt.Close If CBool(cnt.State And adStateOpen) Then Set rst = Nothing Set cnt = Nothing End If End Sub

    Read the article

  • Using Excel VBA to Create SQL Tables

    - by user307655
    Hi All, I am trying to use Excel VBA to automate the creation of a SQL table in an existing SQL Database. I have come across the following code on this side. Private Sub CreateDatabaseFromExcel() Dim dbConnectStr As String Dim Catalog As Object Dim cnt As ADODB.Connection Dim dbPath As String Dim tblName As String 'Set database name in the Excel Sheet dbPath = ActiveSheet.Range("B1").Value 'Database Name tblName = ActiveSheet.Range("B2").Value 'Table Name dbConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath & ";" 'Create new database using name entered in Excel Cell ("B1") Set Catalog = CreateObject("ADOX.Catalog") Catalog.Create dbConnectStr Set Catalog = Nothing 'Connect to database and insert a new table Set cnt = New ADODB.Connection With cnt .Open dbConnectStr .Execute "CREATE TABLE tblName ([BankName] text(50) WITH Compression, " & _ "[RTNumber] text(9) WITH Compression, " & _ "[AccountNumber] text(10) WITH Compression, " & _ "[Address] text(150) WITH Compression, " & _ "[City] text(50) WITH Compression, " & _ "[ProvinceState] text(2) WITH Compression, " & _ "[Postal] text(6) WITH Compression, " & _ "[AccountAmount] decimal(6))" End With Set cnt = Nothing End Sub However i can't successfully get it to work? What I am trying to do is actually use Excel to create a table not a database? The database already exists. I would just like to create a new table. The name of the table will be referenced from cell A1 in Sheet 1. Can somebody please help. Thanks Regards Gerard

    Read the article

  • Integer Overflow in VBA project

    - by mcoolbeth
    Hi, everyone. Here is a small VBA (Excel) function that i wrote, full of MsgBoxes for debugging. I am passing in the numbers 10 and 1 as arguments, and getting an overflow error when the program reaches the top of the For loop, before it begins the first iteration. Any thoughts are appreciated. Function PerformanceTest(iterations As Integer, interval As Integer) As Double Dim st, tot, k As Double Dim n As Integer tot = 0# MsgBox "ok" k = iterations + tot MsgBox "ookk" n = 1 MsgBox "assigned" For n = 1 To iterations MsgBox n st = Timer Application.Calculate tot = tot + (Timer - st) Sleep (1000 * interval) Next n 'MsgBox (tot / k) PerformancTest = tot / k End Function

    Read the article

  • General ODBC Error in VBA

    - by raam
    Hi am populating the data from MS Access By Using VBA i am using below mentioned code.if i am run the same code in MS 2007 then It run properly but if i am run the same code in MS 2003 it gives the "General ODBC Error" how to solve this problem Any help would be appreciated!! Thanks in advance Sub Button2_Click() Dim varConnection As String Dim varSQL As String Dim cal, cal1, x varConnection = "ODBC; DSN=MS Access Database;DBQ=D:\Box\Generate.mdb;Driver={Driver do Microsoft Access (*.mdb)}" ' varSQL = "SELECT * FROM Empdata" With ActiveSheet.QueryTables.Add(Connection:=varConnection, Destination:=ActiveSheet.Range("C7")) .CommandText = varSQL .Name = "Query-39008" .Refresh BackgroundQuery = False End With End Sub

    Read the article

  • [VBA] Create a recurrent event in Outlook

    - by CFP
    Hello everyone! I'm trying to create annual, all-day events with VBA in outlook 2007. I use the following code, but no matter which conbination of Start, StartDate, End, etc I use, it won't create a whole-day event. Either it gives it default start/end times, or it remove the all-day attribute... Dim Birthday As Date 'Get the birthday '... Dim BDay As AppointmentItem Dim Pattern As Outlook.RecurrencePattern Set BDay = Application.CreateItem(olAppointmentItem) Set Pattern = BDay.GetRecurrencePattern Pattern.RecurrenceType = olRecursYearly Pattern.DayOfMonth = Day(Birthday) Pattern.MonthOfYear = Month(Birthday) Pattern.PatternStartDate = Birthday Pattern.NoEndDate = True BDay.AllDayEvent = True BDay.Subject = Contact.FullName BDay.Save When created directly in outlook, entries start on the birth day and end 24 hours later. Yet trying to set Start and End this way results in errors. Plus, entries created outlook have no start/end time in the recurrence pattern (well, they are all-day entries...) Ideas, anybody? Thanks!

    Read the article

  • VBA Tab Key putting actual Tab Value in Text Box instead of navigating to next control

    - by ray023
    I have a VBA form (in Excel if that matters) that contains text boxes. On three occasions, I have found myself pressing the tab key to navigate to the next control, but instead an actual TAB is being put in the text box. The form normally acts as it should, but it does concern me that this gremlin is showing up sporadically. It has shown up on Office 2003 as well as Office 2007 on two different computers. Has anyone else encountered this problem and, if so, how did you fix it?

    Read the article

  • Manipulating excel "autoshapes" with VBA

    - by AME
    I am trying to write a macro in VBA (Excel) that is assigned to a Checkbox. Whenever the checkbox is clicked, an "autoshape" will change its "order" from "Send to Back" to "Send to Front". Basically, I am trying to create a dashboard with multiple panels, so that users can access information without moving between sheets. Each panel will have a rectangular autoshape as its background and the components of the panel will be "grouped" within the autoshape. Can this be done? I would greatly appreciate any ideas into writing the code. Thanks,

    Read the article

  • Excel VBA : Changing string in cells

    - by user1265125
    I have cells with data like these: ABCD123XYZ MPOP345MLU . . . . What I want to do is, to remove the 3rd and 4th character from all these cells, hence giving AB123XYZ MP345MLU How do I do this in VBA? I have no idea about this language, and if someone can guide me in the right direction, it'd be great :) I understand I have to: 1. Declare 2 string variables st1 and st2 2. Store data from cell A1 into the variable st1 3. Copy all but the 2nd and 3rd char into str2 4. Output Str2 into B1 5. Move to A2

    Read the article

  • Excel macro to change external data query connections - e.g. point from one database to another

    - by Rory
    I'm looking for a macro/vbs to update all the external data query connections to point at a different server or database. This is a pain to do manually and in versions of Excel before 2007 it sometimes seems impossible to do manually. Anyone have a sample? I see there are different types of connections 'OLEDB' and 'ODBC', so I guess I need to deal with different formats of connection strings?

    Read the article

  • Excel macro to change location of .cub files used by pivot tables? (to allow .xls files that depend

    - by Rory
    I often use Excel with pivot tables based on .cub files for OLAP-type analysis. This is great except when you want to move the xls and you realise internally it's got a non-relative reference to the location of the .cub file. How can we cope with this - ie make it convenient to move around xls files that depend on .cub files? The best answer I could come up with is writing a macro that updates the pivot tables' reference to the .cub file location....so I'll pop that in an answer.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >