excel-vba

How to determine if a worksheet Cell is Visible/Displayed in VBA?

杀马特。学长 韩版系。学妹 提交于 2020-01-20 05:46:06
问题 I need to find if a cell is visible on the screen. By visible, I don't mean hidden. I am specifically trying to find if a cell is currently displayed in the active sheet, or if it is not displayed, ie: it has been scrolled off of the visible active sheet. I have looked online, and can only find the following code which doesn't seem to work for me: Private Sub CommandButton1_Click() With Worksheets(1).Cells(10, 10) 'MsgBox "Value: " & .Value & ", Top: " & .Top & ", Left: " & .Left Dim

How to look for repeated rows and then delete one of them? requires VBA

若如初见. 提交于 2020-01-19 17:16:08
问题 I was wondering if anyone knows how to delete repeated rows.. Say for example, A B C 1 1 3 4 2 2 6 9 3 TEST 1 2 4 TEST 1 2 5 Both 1 6 Hi 2 7 None 3 3 8 Loud 4 4 For the particular example above, TEST was repeated twice.. In some other cases, the name can be some other kinds such as NOON, Morning, etc.. And row 8 does not necessary be the last row. I have no idea of how to compare the rows to check for repeated names and then delete them away. I need to run a macro with this and so i will need

How to Open only UserForm of an excel macro from batch file

两盒软妹~` 提交于 2020-01-19 06:09:44
问题 I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach : I have written a macros to open the UserForm1 Sub open_form() UserForm1.Show End Sub In batch File: @echo off cd "c:\Test\" openFormTest.xlsm By the above approach, When I'm running the batch file both UserForm1 and excel are getting open, but I want to open only UserForm1. Kindly

How to Open only UserForm of an excel macro from batch file

与世无争的帅哥 提交于 2020-01-19 06:06:42
问题 I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach : I have written a macros to open the UserForm1 Sub open_form() UserForm1.Show End Sub In batch File: @echo off cd "c:\Test\" openFormTest.xlsm By the above approach, When I'm running the batch file both UserForm1 and excel are getting open, but I want to open only UserForm1. Kindly

How to Open only UserForm of an excel macro from batch file

泪湿孤枕 提交于 2020-01-19 06:06:06
问题 I'm trying to open the UserForm1 of an excel macro through batch file. I'm able to open that but excel is also getting opened along with that. I want only UserForm1 to be opened not the excel. Below is my approach : I have written a macros to open the UserForm1 Sub open_form() UserForm1.Show End Sub In batch File: @echo off cd "c:\Test\" openFormTest.xlsm By the above approach, When I'm running the batch file both UserForm1 and excel are getting open, but I want to open only UserForm1. Kindly

How to check for empty array in vba macro [duplicate]

百般思念 提交于 2020-01-18 04:55:23
问题 This question already has answers here : How do I determine if an array is initialized in VB6? (22 answers) Closed 5 months ago . I want to check for empty arrays. Google gave me varied solutions but nothing worked. Maybe I am not applying them correctly. Function GetBoiler(ByVal sFile As String) As String 'Email Signature Dim fso As Object Dim ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2) GetBoiler = ts.ReadAll ts.Close

How to check for empty array in vba macro [duplicate]

北慕城南 提交于 2020-01-18 04:55:10
问题 This question already has answers here : How do I determine if an array is initialized in VB6? (22 answers) Closed 5 months ago . I want to check for empty arrays. Google gave me varied solutions but nothing worked. Maybe I am not applying them correctly. Function GetBoiler(ByVal sFile As String) As String 'Email Signature Dim fso As Object Dim ts As Object Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2) GetBoiler = ts.ReadAll ts.Close

Hide/Unhide cells with empty rows on Worksheet_Change

假如想象 提交于 2020-01-17 16:42:39
问题 I have two columns of data that is pulled into a worksheet from data on other sheets elsewhere in the workbook via a formula in each cell... The first column, Column A, has either a Yes, No or is blank from data that is pulled in via a formula from another sheet. The second column, Column B, also has data pulled in from elsewhere but every row has data in it. What I hope to do is hide any rows that does not have anything in column A. Any rows with data in column A should be visible. I'd like

VBA Macro running too fast

江枫思渺然 提交于 2020-01-17 16:39:27
问题 It's weird that I'm finding ways to slow down my macro. Apart from Doevents and other time delay techniques, which are basically a workaround, is there a way through which we can get around the asynchronous execution. As in, I want the VBA code to behave like this: start executing line 1>finish executing line 1>move to line 2; Forgive if I'm wrong but currently it seems to follow: Start executing line 1>without caring whether line 1 finished or not start executing line2 回答1: If you are

Macro for merging cells

我只是一个虾纸丫 提交于 2020-01-17 16:37:30
问题 I have an Excel file with Invoice number in Column B, ( B2:B14987 ), in Column C I have Item ID's, in Column D I have Sold Value, in Column E I have Invoice-Discount Value. I need a macro to merge the Invoice Discount value cells based on Invoice number column, invoice numbers are repeated as there are different item ID's in one invoice. For example: B1:B3 are the same invoice number, E1 is the common discount value for the invoices which are in B1:B3 , E2:E3 are blank cells. So I want E1:E3