excel-vba

Excel Return Whole row when it Matches Cell

余生颓废 提交于 2020-01-25 04:17:14
问题 I have a workbook with two sheets. Sheet 1 has all of the data. Sheet 2 is currently blank and I am planning to use a VLOOKUP to return any row that matches the certain cell. In sheet 1 in column E there are different values in each cell, I want to return any that say tyre I want them to copy the whole row of data whenever column E contains the word tyre. The word tyre is in Cell B1 in Sheet2 I have currently tried this code which is in sheet 2 but just getting a #VALUE! error. =VLOOKUP($B$1,

Remove single quote VBA function

感情迁移 提交于 2020-01-25 01:26:52
问题 To simplify, I have two sheets in an Excel workbook. If I write =sheet2!R3C2 in one of the cells of sheet1, the cell takes the value of the cell R3C2 of sheet2 correctly. I would like to generalize that for many rows in VBA, so my code is: row = XX a long temp = "=sheet2!R" & row - 1 & "C2" Range("c" & row).Value = temp But when I use this code, the value of the cell(row,3) is =sheet2!'RXXC2' How can I remove the single quotes ?? 回答1: Range("C" & row).Formula = temp would produce the correct

Allow user to make entries on worksheet during run-time

两盒软妹~` 提交于 2020-01-25 01:08:16
问题 All: Thank you in advance, you all have been a tremendous resource!!! I have a couple of spreadsheets where the sheet is protected, but users can still use filters. I'm processing most of the sheets automatically, but what I need to do, is present the user with the sheets that need to be filtered, then have them select a "Finish" type button or toolbar entry, which I already have. What I need to be able to do, is to bring this sheet up, pause the macro, if possible, while they make their

Open/Close ADO Connection

旧时模样 提交于 2020-01-25 01:01:10
问题 I am trying to import data from Access to Excel. There are four columns in the Access table: Date, Time, Tank, Comments. On importing the Time and Tank columns, I sort them based on date. Additionally, I import them separately so I can swap the column order form Time, Tank to Tank, Time. In the programming I have to close and open the ADO connection for that. I want to make the program more efficient by avoiding closing the connection and having to open it again. Any suggestions/solutions?

Copying multiple images from one workbook to another as separate images

旧城冷巷雨未停 提交于 2020-01-25 00:51:26
问题 In 2003 the code worked perfectly, we just updated to 2010 and its affecting our outgoing proposals. I've been looking on multiple sites and everything i have tried gives me all the pictures pasted into one grouped image OR gives me multiple boxes that say image cannot be viewed. The pictures will always be located in column L, but it can be one picture or 50 and even none. So i need to be able to select all images, copy and open another workbook and paste in a designated column with the same

.send not working vba but .display is

最后都变了- 提交于 2020-01-25 00:47:11
问题 My ".send" is not working however my ".display" is? I keep getting an object defined error. and when I debug it highlights the ".send". Any suggestions? Sub SendEmails() Dim olApp As Outlook.Application Dim olMail As Outlook.MailItem For i = 8 To 10 Set olApp = New Outlook.Application Set olMail = olApp.CreateItem(olMailItem) With olMail .BCC = Cells(i, 1).Value .Subject = Cells(i, 2).Value .Body = "Hello " & Cells(i, 3).Value & "," & vbNewLine & vbNewLine & Cells(i, 4).Value & vbNewLine &

Use formula to update cells, but as values

北慕城南 提交于 2020-01-24 22:09:26
问题 I've been working with a large set of data in Excel that I use macros to populate formulas in from two different source spreadsheets. The problem is that having so many formulas is causing the spreadsheet to slow to a crawl. Internet searches have led me to believe that I need to set my data as values. I've tested one method that caught my eye, but can't get it to work the way I need it to. Range("D1:D10").Formula = "=SUM(A1:A10)" Range("E1:E10").Formula = "=SUM($A$1:$A$10)" Range("F1:F10")

VBA Macro Concatenation for Excel

柔情痞子 提交于 2020-01-24 20:48:29
问题 I have a requirement like I have some values in column A and I have multiple values in column B,C,D. If my column contains value X then I want to column header and column A value to be concatenate. For example I have gone through lots of question on Stack Overflow and I didn't found anything helpful. Thanks for your help! 回答1: please try this code. Sub FindValues(ByVal WhereToFind As Range, ByVal WhereToPaste As Range) 'where to find should have the header and values Dim col As Integer 'loop

VBA convert a binary image to a base64 encoded string for a webpage

痴心易碎 提交于 2020-01-24 20:12:14
问题 I am trying to read in a JPG file and convert the file to a base64 encoded string that can be used as an embedded jpeg on a web page. I found two functions on the web for base64 encoding/decoding in VBA that appear to be well-accepted. The encode/decode process yields my original binary string, so the functions appear to be at least somewhat correct. However the base64 string I am getting is no where near what I get when I use an online tool to convert my image to base64. The base64 string

Excel split sheet data by name into new Excel Workbook [duplicate]

微笑、不失礼 提交于 2020-01-24 18:09:52
问题 This question already has answers here : Create a new sheet for each unique agent and move all data to each sheet (2 answers) Closed 2 years ago . Model Place model23 35372 model23 35372 model54 31034 model24 31034 model54 31034 model24 31034 I Have this Excel data (the data is bigger is 38000 lines+ I can add all here) I want try 2 paths.. 1)Split the sheets by name model (but I want take and name model and place. Example: SheetName: model23 Model Place model23 35372 model23 35372 2)If I can