excel-vba

(Excel VBA) If Cell Value equals “” Then Show/Hide Images

眉间皱痕 提交于 2020-01-21 07:36:26
问题 I am working on a Excel Spreadsheet that when a dropdown box value is selected an image will pop up, and if another value is selected it will hide the current image and pop up the image related to the selection. I have found a few methods that are just too time consuming using just the sheet and positioning of the image using coordinates; that's not exactly the route I would like to go.I have done a quite a bit of research before using StackOverflow, and nothing seemed to work thus far. Below

VBA Saving single sheet as CSV (not whole workbook)

坚强是说给别人听的谎言 提交于 2020-01-21 06:14:04
问题 I appreciate there are lots of entries like save individual excel sheets as csv and Export each sheet to a separate csv file - But I want to save a single worksheet in a workbook. My code in my xlsm file has a params and data sheet. I create a worksheet copy of the data with pasted values and then want to save it as csv. Currently my whole workbook changes name and becomes a csv. How do I "save as csv" a single sheet in an Excel workbook? Is there a Worksheet.SaveAs or do I have to move my

Iterating unregistered add-ins (.xla)

落花浮王杯 提交于 2020-01-21 01:42:08
问题 I need help in figuring out how to iterate through currently open Excel add-in files (.xla) that have not been registered in Excel using the Tools > Add-ins menu path. more specifically, I am interested in any workbook that doesn't appear in the Add-In dialog, but has ThisWorkbook.IsAddin = True . Demonstrating the issue: Trying to loop through workbooks as follows doesn't get workbooks with .AddIn = True : Dim book As Excel.Workbook For Each book In Application.Workbooks Debug.Print book

Can't run DIR from WScript Shell in VBA?

折月煮酒 提交于 2020-01-20 08:38:10
问题 I use the following function in a lot of my VBA projects. I initially added the reference to Windows Script Host Object model to take advantage of Intellisense, but then switched to late binding so I didn't have to reference a bunch of stuff. Private Function RunCMD(ByVal strCMD As String) As String 'Runs the provided command Dim oShell As Object 'New WshShell Dim cmd As Object 'WshExec Dim x As Integer Const WshRunning = 0 On Error GoTo wshError x = 0 RunCMD = "Error" Set oShell =

Can't run DIR from WScript Shell in VBA?

孤街醉人 提交于 2020-01-20 08:38:08
问题 I use the following function in a lot of my VBA projects. I initially added the reference to Windows Script Host Object model to take advantage of Intellisense, but then switched to late binding so I didn't have to reference a bunch of stuff. Private Function RunCMD(ByVal strCMD As String) As String 'Runs the provided command Dim oShell As Object 'New WshShell Dim cmd As Object 'WshExec Dim x As Integer Const WshRunning = 0 On Error GoTo wshError x = 0 RunCMD = "Error" Set oShell =

Excel VBA web scraping for data table

爱⌒轻易说出口 提交于 2020-01-20 07:51:47
问题 I am trying to get data from Roster Resource, here's an example of a webpage (https://www.rosterresource.com/mlb-arizona-diamondbacks). At the very minimum, I want to get the "Projected "Go-to" Starting Lineup" and import that data into my spreadsheet. I would then do this for every MLB team from Roster Resource to create a sheet that has every team and the projected lineup for each team. I have tried some methods of "getElementById" and "getElementsByClassName", but I'm having difficulty

repeating script that goes from SAP to Excel and back again

徘徊边缘 提交于 2020-01-20 07:35:46
问题 I am trying to build a script that takes the data out of a huge report in SAP, runs some cleanup in Excel, and then load it into Access. At least, that is my eventual goal. The data in SAP is a bit polluted, which is why we are resorting to Access as the place where cleansed data specific to our department lives. I'm new to scripting (after 20 years, I don't remember much of what I used to know) but I have been using the built in macro generators in both SAP and Excel and have gotten part of

repeating script that goes from SAP to Excel and back again

偶尔善良 提交于 2020-01-20 07:35:25
问题 I am trying to build a script that takes the data out of a huge report in SAP, runs some cleanup in Excel, and then load it into Access. At least, that is my eventual goal. The data in SAP is a bit polluted, which is why we are resorting to Access as the place where cleansed data specific to our department lives. I'm new to scripting (after 20 years, I don't remember much of what I used to know) but I have been using the built in macro generators in both SAP and Excel and have gotten part of

Excel VBA - Passing a variable path with spaces to WinSCP command-line

天大地大妈咪最大 提交于 2020-01-20 07:21:08
问题 I have the code at the bottom of this post inside one of my excel books (my first time ever writing vba code). The goal here is to allow users to: start a video encode using MXLight software with a temp file name select a cell with the person currently on video stop the video encode, rename the temp file, move it to a specific folder, upload it via FTP via WinSCP software, mark it green, move one cell down. So during the event, you: Press button 1 which is the Sub StartMXL then you highlight

VBA to set Zoom level on Sheets

别来无恙 提交于 2020-01-20 06:12:08
问题 I have a VBA that will set the zoom level based on the screen resolution. But its working only for ActiveWindow when you open workbook. How can I add this across all worksheets in Excel? Declare Function GetSystemMetrics32 Lib "user32" _ Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long Public Sub ScreenRes() Dim lResWidth As Long Dim lResHeight As Long Dim sRes As String lResWidth = GetSystemMetrics32(0) lResHeight = GetSystemMetrics32(1) sRes = lResWidth & "x" & lResHeight Select Case