New line and COUNTIF function for VBA

I'm trying to count the number of occurrences of '1' in column (W_1). I used the following code on VBA (a part of the entire code - will add more if needed). The data is also part of a table. Private Sub Macro() LastRow = x.Sheets("W_10").Range("A"...
more »

2017-06-22 19:06 (3) Answers

Opening macro security from VBA on startup

I currently have a code that on startup checks if the option "Trust access to the VBA project object model" is enabled or not. In the case that it is not enabled, I need the program to open the macro security settings for easy access for the user. ...
more »

2017-06-22 15:06 (2) Answers

Transfering note to own column by row in Excel

I have a very large excel file with hundreds of notes on different cells. I would like to extract the notes contents of each row and put them in their own column. For example if I had 3 notes in row 1, the text from those comments would be put in say...
more »

2017-06-22 15:06 (1) Answers

How to get an object out of a collection in VBa

I used to have the following working code Set result = DecodeJson(MyRequest.responseText) Dim keys() As String keys = GetKeys(result.issues) Now, my approach has changed and instead of having result being the object, I receive a Collection base...
more »

2017-06-22 15:06 (1) Answers

Paste clipboard in outlook email in normal order

I have 5 userforms for an email. The workflow goes like this: create new email user selects the fields automatic printscreen is inserted in the text user selects the fields automatic printscreen is inserted in the tex...
more »

2017-06-22 10:06 (1) Answers

Application.VLookup function always returns #N/A

I am trying to use the Application.VLookup function in Visual Basic to find a value in a different workbook. However, whenever I use it, it always returns #N/A. This is the layout of my function. LastRow() just returns the row number of the last row...
more »

2017-06-22 00:06 (2) Answers

Excel VBA - Moving a column down

I have a portion of my script that needs to move a column down, so that the start of the new column is at the end of the column next to it. For example, if column "A" is 229 Lines, Column "B" would start at line 230. Here is what I have so far: O ...
more »

2017-06-22 00:06 (1) Answers

Monitor class events from userform

I have a userform which assembles itself at runtime, by looking in a folder and extracting all the pictures from it into image-controls on my form. What makes the process a little more complex is that I'm also using the image-controls' events to run ...
more »

2017-06-21 11:06 (2) Answers

Bypass the Workbook_SheetChange event

I don't know why, and this is quite strange, but my code is looping. Indeed, in a first sheet (ws1), i'm doing this on a Worksheet_Change event : Application.EnableEvents = False ws2.Range(Col_Letter(target.Column) & LastLine & ":" & Co...
more »

2017-06-21 10:06 (1) Answers

excel sheet wont scroll after adding userforms

I have buttons for going to other sheets in my workbook so I can hide other tabs to keep it cleaner. Everything worked fine until I added some userforms into the mix. Now when I use my button to activate another sheet it goes there but sometimes won'...
more »

2017-06-20 19:06 (1) Answers

Create Column Chart from Pivot table

I am trying to create Column Chart from Pivot table. I am able to generate the Pivot table from my code by recording the macros. I tried in the same way to generate the Chart by recording the macros, but it was confusing. So, I tried my own code...
more »

2017-06-20 12:06 (1) Answers

VBA macro to compare and add value

I want to do a macro for comparing values in one sheet with the other sheet and copying the unique values. Explanation: I get a bunch of IDs on weekly basis (Worksheet A). I want to see which of these IDs I already worked with in previous weeks (th...
more »

2017-06-20 10:06 (1) Answers

Can I get VBA equivalent of DateTime.Now.Ticks?

In VB within .NET I can use DateTime.Now.Ticks.ToString("x") to get a string ready for a multipart form boundary e.g. 8d4b7556f42792c I'm trying to get the same thing in VBA within Excel. In Excel VBA I can use DateTime.Now to get now in the format...
more »

2017-06-19 22:06 (1) Answers

VBA + Excel + Try Catch

In VBA I'm doing a simple script that records a version of a spreadsheet being used. Private Sub Workbook_Open() version = "1.0" Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") URL = "<WEB SERVICE>" objHTTP.Open "POS...
more »

2017-06-19 21:06 (1) Answers

Parsing Outlook Emails and Exporting to Excel VBA

I'm currently writing a VBA macros script run in Microsoft Outlook which should parse key information from emails and store them into an Excel spreadsheet. Right now, I am stuck on the logic of parsing and extracting what I want. Here is a short e...
more »

2017-06-19 21:06 (2) Answers

VBA - Print lines to a .txt file

i'm having issues while printing values in a text file. Whenever I have a date or numbers, I get an "Error 13"... I guess it's linked to my variables but I can't understand where the problem is. Sub SX_Externe_Generate_TXT() Dim WsCib As Worksheet D...
more »

2017-06-19 20:06 (1) Answers