Posts by danieltakeshi • 3,960 points
212 posts
-
1
votes1
answer1287
viewsA: Correct formatting for excel vba time
Text only It is not necessary to format if you only want to import the text to Listview, as it is already formatted correctly in the spreadsheet. A test was performed with the following data: And…
-
0
votes1
answer235
viewsA: User name with open Excel file - VBA
The Windows computer username can be viewed as follows: Dim usuarioPC As String, usuario As String usuario = Environ("username") usuarioPC = Application.UserName MsgBox "O usuário deste PC é o "…
-
0
votes1
answer1553
viewsA: How to change with VBA the sender email and insert the signature for outlook email triggering?
Send from desired Outlook user For this, the .Sendusingaccount should be used and as input parameter an account of your Outlook. In this example the account is being entered manually or fixed with…
-
0
votes1
answer83
viewsA: Option "Cancel" Getopenfilename(Multiselect:= True)
Problem With Multiselect:=True, filename will be a vector or a boolean, so types are uncopyable and a conditional needs to be created to verify which data type is returned. If the "Cancel" button is…
-
1
votes1
answer559
viewsA: Convert BGR to RGB (Opencv)
Problem With img = cv2.imread('framepng/frame24.png',0) the image is converted to grayscale, because the flag 0 is used. With this, you lose all the color information that was present in the image.…
-
0
votes2
answers684
viewsA: Save Path Name and Worksheet Name to a Cell
There are a few ways to accomplish this, if you already have the String with the full workbook path ThisWorkbook.Path, it is possible to manipulate strings to get the desired result, as can be seen…
-
2
votes1
answer292
viewsA: Edge -1 using erode and dilate (Python)
Problem Images are uploaded by Opencv as unit8, for more information on data types read this link from Numpy. Therefore, they are unsigned int, that is, they have no sign (negative number). So by…
-
1
votes1
answer133
viewsA: I need to take a column with a lot of redundant information and just take one of them
If the Combobox is in a form, the code must be entered in the Subroutine Private Sub UserForm_Initialize() to load the Combobox data when initializing the form. Code Dim x As Long, ncell as Long Dim…
-
0
votes1
answer608
viewsA: VBA - Automatically Clear Cell Information - Event Change
The answer is similar to the answer: Copy and paste cell when changed However, instead of copying and pasting, one should clean the cell. Insert Event code Use the event Worksheet_Change, where the…
-
2
votes3
answers426
viewsA: Select area escpecify in excel VBA spreadsheet
To not use fixed references and search for the title, you can use the Excel function Match() and get the column number of a starting point and an ending. With this, you can Select table data and you…
-
0
votes1
answer318
viewsA: Using Formular1c1
A way to insert the formula with .FormulaR1C1 is to insert a summation formula that goes from the first cell before Subtotal to a cell before Subtotal. This can be accomplished with the following…
-
0
votes1
answer137
viewsA: Capture an excel autofilter criterion based on cell color
The criteria and the operators are correct, but I believe that the autofilter is being used in the wrong way. With the following sample data in Column D: Code: Sub filtrar() Dim ws As Worksheet Dim…
excel-vbaanswered danieltakeshi 3,960 -
4
votes1
answer711
viewsA: How to add euro currency symbol (€) on a . tex page in Latex?
You can use the package eurosym. Utilizing \usepackage{eurosym} ... The book is 10 \euro. The book is \euro 10. The book is \EUR{10}. \textbf{The book is \EUR{10}.} \textit{The book is \EUR{10}.} If…
latexanswered danieltakeshi 3,960 -
0
votes1
answer80
viewsA: VBA code does not want to run in the desired tab
You’re taking the last line of the "XX" tab, try Worksheets("Premissas").Cells(Worksheets("Premissas").Rows.Count, 2).End(xlUp).Row and in cells within Range(), are also without reference…
vbaanswered danieltakeshi 3,960 -
0
votes1
answer418
viewsA: getElement does not declare the object (VBA) . IE
HTML Adding a JS to the HTML code to check if it was clicked: function toggleText() { var text = document.getElementById("demo"); if (text.style.display === "none") { text.style.display = "block"; }…
-
0
votes1
answer189
viewsA: error in openCv Python drawContorns
Some problems in your code, the first is that it does not show the outlines drawn for two reasons: In function cv2.drawContours(img , contornos, -1, (0,255,0),2) you draw the outlines in img, while…
-
0
votes2
answers133
viewsA: Unify multiple worksheets from different workbooks
See the following code, in which unifies the data in the open sheet, in the same workbook where the code is. The program opens all files that are in a folder, which must be selected with the…
-
1
votes1
answer212
viewsA: Page in landscape, not figure
pdflscape If you are using a Latex PDF editor, use pdflscape, which adds PDF support to the package lscape. According to the following example code: \usepackage{pdflscape} ... \begin{landscape} ...…
latexanswered danieltakeshi 3,960 -
1
votes1
answer55
viewsA: Get the address of Cell Crossing Worksheets in Excel
You can manipulate this string with the following function in Excel in English, where A1 is the location of the formula…
excelanswered danieltakeshi 3,960 -
0
votes2
answers608
viewsA: Algorithm that performs the combination of elements of a vector in VBA?
In the code below, the input was an array arr = Array(5, 4, 3, 2, 1) and 3x3, that is to say, p = 3. Then the function comb_elementos is called with the array and the amount of elements as…
-
0
votes1
answer150
viewsQ: How to encode a number with the notation x and not 0x
Problem I’m performing a serial communication in which the checksum the message needs to be sent or verified upon receiving. This must be checked with a XOR logic, which returns an int number, given…
-
3
votes1
answer269
viewsA: How to improve/optimize a color image conversion code to grayscale
Problem An image is an array, so you can use Python or a library, like Numpy, to avoid using for loops. Gazing the grayscale Wiki, it is possible to check the following formula: Y = 0.2126 * R +…
pythonanswered danieltakeshi 3,960 -
0
votes1
answer177
viewsA: Apply button - Visible cells
Problem You are entering the position of the Listview table in the "Tableau Trainings" worksheet, but, this is not the one that should be sought. Because the Listview indexes change when filtering,…
-
1
votes1
answer443
viewsA: Delete whitespace from Activex Excel combo box
Problem When filling the combination list by property ListFillRange, this error will occur. Solution Then the following code can be used to remove duplicates, remove empty cells and sort (if you…
-
2
votes1
answer1350
viewsA: Problem configuring "Figures" in Latex
The problem is the spaces in the image path, include the package \usepackage[space]{grffile} in your Latex. Follow an example code: \documentclass{article} \usepackage[utf8]{inputenc}…
latexanswered danieltakeshi 3,960 -
0
votes1
answer366
viewsA: Extract file . zip Password protected
Use the Ron de Bruin’s sample program, one of the best sites for Excel VBA, along with the Cpearson. This program uses Windows Shell and to unzip, uses the 7-Zip, where the program installation path…
-
3
votes2
answers790
viewsA: Check with REGEX VBA if phone is fixed or mobile (checking 3rd number in regex)
Regex problem The problem with your Regular Expression is that it does not validate, for example if a fixed number starts with 4? Many commercial phones start with 4, mainly in São Paulo, which has…
-
0
votes2
answers581
viewsA: Create a spreadsheet with folder names listed from a directory in excel
Folders To create a sheet with the Folder name and fill in column A, use the following code, where the explanation is commented in the code: Option Explicit Sub Listar_Pastas() ''''''''''''''''''''…
-
1
votes1
answer1636
viewsA: Textbox returning different decimals in VBA
Problem With an example form with a Textbox and a Commandbutton: You can check the data type of the text box with Vartype or Typename: Debug.Print VarType(TextBox1.Value) Debug.Print…
-
0
votes2
answers136
viewsA: How to do continuous firing in python?
With the library Matplotlib (plt) this can be achieved using Funcanimation In that key of event to stop image playback is in event.key with if event.key == 'ctrl+c':. The conversion of BGR, Opencv…
-
1
votes1
answer136
viewsA: How to unify display windows?
You can use the function hstack of Numpy to join the images. Because images are matrices. So instead of: cv2.imshow("DIREITA",frame1) cv2.imshow ("ESQUERDA",frame2) Two frames are joined together as…
-
0
votes1
answer125
viewsA: format Excel timestamp
With Tue Apr 23 2019 11:49:21 GMT+0100 (GMT+01:00) in A2. The following function: =TEXTO(EXT.TEXTO($A2;LOCALIZAR(":";$A2)-2;8);"hh:mm:ss") Returns:…
-
2
votes1
answer1196
viewsA: Cut part of an Image using a point list of a polygon
Program steps Load the image with Opencv Create a copy of the original image to change only the copy and keep the original in memory Converts from BGR color space to grayscale as the functions used…
-
0
votes2
answers1003
viewsA: How to do a regex to capture a sequence in numbers with dots and strings
Regular Expression If the string is on the same line, and does not have a new line (CR or LF), use the following Regular Expression: \d+(?:\.\d+)*[\s\S]*?\D(?=\s*(?:\d|$)) And see the demo on…
-
1
votes1
answer157
viewsA: Use VBA in excel to fetch data in . Docm files located in Subdirectories
There are several ways around this problem, two of them are: User chooses the subfolder; You receive data from all Subfolders. Choose the subfolder An example code of how to choose the desired…
-
0
votes1
answer566
viewsA: Position userform on the same monitor excel is on
Code You can use the following code in the desired Userform: Private Sub UserForm_Initialize() With Application Me.StartUpPosition = 0 Application.WindowState = xlMaximized Me.Top = .Top Me.Left =…
-
2
votes1
answer133
viewsA: Regex to validate document - Javascript
See the demo of the Regex101: With the examples given the following regular expression can be used: ^(?!(\d)\1{10,})(?=.*\d)[A-Za-z0-9]{11} You were already trying to use the Negative Lookahead ?!…
-
1
votes2
answers46
viewsA: SE - Excel function
You can use the function SES() to create multiple conditionals. Then the following formula can be created, with three different conditions:…
-
1
votes1
answer574
viewsA: Reset a dynamic array - Redeem or Erase?
Redeem and Erase The best would be to follow the semantics, so that someone else who reads the code or yourself can understand more easily and help in maintaining the code in the future. Then the…
-
0
votes1
answer51
viewsA: How do I make a conditional using just using the date MONTH and from it insert a formula into a certain cell?
Your syntax of the formula =SE() is wrong. Insert the following formula into S2: =SE($A2="";"";SE(MÊS($A2)=1;TEXTO(MÊS($A2);"mmmm");"errado")) The function =MÊS() returns the month of a date in…
excelanswered danieltakeshi 3,960 -
0
votes1
answer123
viewsA: Blockinput VBA/EXCEL
With a test to check the Windows version and the Office package: 'https://stackoverflow.com/a/27931754/7690982 Sub versao() #If Win64 Then #If VBA7 Then MsgBox "Win 64 and Office 64" '…
-
0
votes1
answer697
viewsA: Help with VBA Excel - lock cell after fill
First you must enter Locked = False in all cells of the spreadsheet only once, with the following code: Sub Destravar_Tudo() ActiveSheet.Unprotect ActiveSheet.Cells.Locked = False End Sub For by…
-
1
votes1
answer1337
viewsA: Pass Array as parameter in VBA (Excel)
You had a syntax problem, because you don’t want to pass an array, but rather the user-defined type pessoa, see the codes below: Function Public Type pessoa Nome As String Idade As Long End Type…
excel-vbaanswered danieltakeshi 3,960 -
2
votes0
answers539
viewsQ: What is the difference between the infinite loops for(;;) and while(true)?
What is the difference between infinite loops for(;;) and while(true)? Is there any advantage or disadvantage of using one or the other? For example, in a simple terminal input validation code, to…
-
2
votes1
answer81
viewsA: VBA Add "-" every two characters to form MAC Address
Code Function MACADddress(macaddress As String) As String Dim i As Long, C As Long, k As Long Dim NewMac As String NewMac = "" C = 0 k = Len(macaddress) For i = 1 To k C = C + 1 If C = 2 And i…
-
1
votes2
answers335
viewsA: Disable Vba Excel View Mode
This code of Mr Excel keeps the security status of the spreadsheet in the variable lSecurity, then switches to the low security level msoAutomationSecurityLow and then returns to the original…
-
1
votes2
answers138
viewsA: List in Python
With the following entry: 1 2 3 4 5 6 7 8 9 0 The following output is obtained: 0 9 8 7 6 5 4 3 2 1 With the following code: [print(x) for x in input().split()[::-1]] And a reverse list ['0', '9',…
pythonanswered danieltakeshi 3,960 -
0
votes2
answers735
viewsA: VBA Merged Cell
To obtain the value directly, the value of the leftmost and uppermost cell is usually used. But there is a better way to get, as can be seen in the following code: Sub valor_mesclado() MsgBox…
-
1
votes1
answer490
viewsQ: Convert function arguments to string
How to convert function arguments to string? Without having to type all arguments I tried to solve it this way: def teste(a, b, c, d, e='F9', f=1): for key, value in locals().items(): key =…
-
1
votes1
answer405
viewsA: Problem when displaying text with cv2.QT_FONT_BOLD source using Opencv in Python
Opencv By looking at the code of drawing.cpp and in the documentation, you can see that the function parameters putText sane: Parameters img Image. text Text string to be Drawn. org Bottom-left…