Excel: good coding practices with VBA

As I am new to this site, I will try to start with something very simple.

I am doing an "automatic insertion" into an Excel spreadsheet and my code works correctly, but I am not so sure of my coding form, so I would like to post it here and see if anyone is going to help me with.

Here is my code:

Option Explicit

Sub inserisciAutomatico()
Application.ScreenUpdating = False
Application.EnableEvents = False

Dim KitNr As String
Dim KitNrAppoggio As String
Dim kitNrSecondoAppoggio As String
Dim provaFormula As Range    
Dim primoValore As String    
Dim numeroID As String    
Dim descrizione As String
Dim gruppo As String

Dim concatena As String
Dim disegno As String
Dim treD As String
Dim distinta As String
Dim immagine As String
Dim formulaCopy As String

Dim cell As Range
Dim risultato As Range
Dim risultatoAppoggio As Range

Dim valore As String
Dim appoggio As String

Dim provissima As Integer

valore = Worksheets("CODICI").ComboBox1.Value
appoggio = "fine"

Set cell = Worksheets("CODICI").Range("D4:D250").Find(valore)

'Debug.Print cell.Address

Set risultato = Worksheets("CODICI").Range("D4:D250").Find(appoggio, LookIn:=xlValues, After:=cell)
Set risultatoAppoggio = Worksheets("CODICI").Range("D4:D250").Find(Worksheets("CODICI").ComboBox1.Value, LookIn:=xlValues)

'Debug.Print risultato.Address
'Debug.Print risultatoAppoggio.Address

'kitNr = risultato.Offset(0, -2)
kitNrSecondoAppoggio = risultatoAppoggio.Offset(-1, -3)

Set provaFormula = Worksheets("CODICI").Range("Z1")

provaFormula.FormulaArray = "=MAX(IF(LEFT(B7:B250,1)=""" & kitNrSecondoAppoggio & """, B7:B250))"

KitNr = Worksheets("CODICI").Range("Z1").Value

Debug.Print provaFormula.FormulaArray

KitNrAppoggio = KitNr + 1

'Application.WorksheetFunction.Max (Range("a:a"))


primoValore = risultato.Offset(-1, -3).Address
numeroID = risultato.Offset(-1, -2).Address
descrizione = risultato.Offset(-1, 0).Address
gruppo = risultato.Offset(-1, 1).Address
concatena = risultato.Offset(-1, 2).Address
disegno = risultato.Offset(-1, 3).Address
treD = risultato.Offset(-1, 4).Address
distinta = risultato.Offset(-1, 5).Address
immagine = risultato.Offset(-1, 6).Address
formulaCopy = risultato.Offset(-2, 2).Address

Range(primoValore).Value = "T0"

Range(numeroID).Value = KitNrAppoggio
Range(numeroID).Borders(xlEdgeBottom).LineStyle = XlLineStyle.xlContinuous
'Range(numeroID).Borders(xlEdgeBottom).Weight = xlHairline
Range(numeroID).Font.Bold = False
Range(numeroID).Font.Name = "Calibri"
Range(numeroID).Font.Size = 10

Range(descrizione).Font.Bold = False
Range(descrizione).Font.Name = "Calibri"
Range(descrizione).Font.Size = 10
Range(descrizione).Value = Worksheets("CODICI").TextBox1.Value
Range(descrizione).Borders(xlEdgeBottom).LineStyle = XlLineStyle.xlContinuous
'Range(descrizione).Borders(xlEdgeBottom).Weight = xlHairline

Range(gruppo).NumberFormat = "@"
Range(gruppo).Value = Worksheets("CODICI").ComboBox2.Value
Range(concatena).PasteSpecial xlPasteFormulas
'Range(concatena).Value = "T0" + KitNrAppoggio + Worksheets("CODICI").ComboBox2.Value

Range(disegno).Value = ".dwg"
Range(treD).Value = ".asm"
Range(distinta).Value = ".xls"
Range(immagine).Value = ".jpg"

Thank you

How to best balance SalesForce "requirements" with UX best practices in contact / chat forms?

By developing some new contact and chat fields (not closed), I discover that when I comply with SalesForce's "requirements", the fields are a UX nightmare.

I am finishing with a minimum of 5 fields, and with our other (legal) requirements, the module is finishing at a stupid height of more than 768px.

– First name
– last name
– email

– phone
– comment / subject

All with their respective natures required or not indicated as they complete the fields (without asterisks, etc.). Sales tell me that they cannot process leads with the preferred unified name field. Can I bring ammo to the table to say how horrible and cumbersome this is, and how will we have higher bounce rates? I told them those things and they don't care. The reason for the name separation and the email request. It is for linking cases, for existing accounts in that case, as well as for leads.

I also want to delete the phone number field when the chat is online, and keep it when they send a general contact request when the chat is offline, if there is any validity there, but I would like to have more business reasons instead of " UX no I don't know anything "excuses" I keep giving them.

Thank you.

Programming practices: different ways to run a custom DSL program

With a small DSL (domain specific language), I want to move from editing to analysis and execution. Editing is clearly not a problem, and analysis is practically a problem solved. But I'm not sure how I should do to run the small programs I write.

The DSL has two main objectives: to specify the conditions that must be calculated at runtime (based on a given input) and the actions that are activated if (or not) the conditions are met. Conditions may vary from simple Boolean values ​​to more complex Boolean expressions and calculations, but the result is always Boolean. The actions are a little more varied, but can be broken down into manipulations of internal data structures.

I think the scenario of how the DSL program runs is also important. There is a server application that must embed the program, the analysis must be performed on the clients or another server application. In any case, the program would be serialized in some way and sent to the main server application.

Now I would like to know what approaches (in general) I can take. What format should the analyzed program have to run efficiently? And how would he really execute it? A personalized interpreter? Compile in native code probably won't work. Is there any potential to include optimizing libraries (maybe for Boolean operators …)?

Graphical user interface design: best practices for desktop application icons

I am developing a tool for software specifically for desktop computers only, and I wonder what is the best practice for handling many icons.

Right now I have them next to a tree view, since they are all related to what is currently selected. Although I keep hearing that unless your icons are very recognizable, it is better to have text next to the icons to make it easier to know what they do at a glance.

I can do that and place them on top of the tree view, but I think it would take up a lot of space and could make the tool suddenly feel very crowded.

You could leave it as it is and consider adding an instant tooltip while the mouse moves over the button, but that still does not solve the original problem of understanding the button at a glance.

What is the best practice to do in this case?


Firebase Hosting Image URL best practices

I just uploaded some images to Firebase storage and I want to call an image URL link from the API. Do I use the link shown in the attached graphic? has the url https://firebasestorage.googleapis.com/v0/b/..... or is there another link that can't be seen that starts with gs://domain.com... ?

enter the description of the image here

Programming practices: when to use first / third person verbs?

var val = obj.GetValue();
var val = obj.PlayOnAwake; // From Unity

It is not in the first person, it is essential. Simply put, it is a command.

  • GetValue() Get the courage!
  • PlaySound() Listen to this sound!
  • DeleteFile() Delete that file!

These names are used for methods, especially methods that perform a task (instead of returning a known value).

var has = obj.HasValue;

What you call third person is curious. Ask a question, specifically a yes / no question, because it represents a boolean nature.

  • isReadOnly Is this file read-only?
  • requiresConstantRepaint Does this object require constant repainting?
  • isAdmin Is the user administrator?

These names are used for Booleans, since the yes / no nature of the phrase reflects the true / false nature of the Boolean.

var val = obj.RequiresConstantRepaint(); // From Unity

There are some methods whose Boolean return value is their sole purpose. These methods tend to follow Boolean nomenclature schemes (question) instead of method (imperative) nomenclature schemes, to further highlight their purpose of providing a true / false distinction (yes / no).

class RequireComponentAttribute // From Unity

The attributes follow a slightly different approach. Its nomenclature is not as consistent and is often less semantically inclined than the Boolean method / nomenclature mentioned above.

  • (XmlIgnore) it is a forced imperative ("ignore this in XML form")
  • (Fact) It is a noun
  • (Obsolete) It's an adjective

More often, nouns and adjectives are used since attributes are commonly read as "additional" descriptions added to a class / method / property. But there is no hard line to draw here compared to the much more conventionalized method / Boolean names mentioned above.

Best practices / current settings?

Does it seem that the sticky thread is some years old?

I just wonder if there is a current thread or a post that someone can refer me to get the current best practices / settings of 80/20 for gsa.

Is Serengines the best current option for more platforms to publish beyond what gsa has internally?

What should I combine with gsa captcha breaker to get the most out of my money to solve captchas? Especially for the best contextual platforms.

Any other configuration or suggestion for the current software, and the current SEO scenario, would be great.

Thanks yall

programming practices: how to accredit temporary collaborators ethically

For a hackathon, my friend and I work together on a project and manage to execute it in its most basic form. Now I want to continue the development, and since it is no longer invested in it, I will do it alone. My question is, how to prove it ethically in the project?

Undoubtedly, he put work in the code modules, but I will also expand them greatly, as well as the rest of the project. I wish I could use the code in my portfolio, in which case I don't want it to seem like I only did half the work. On the other hand, I definitely don't want to cut it, since that seems wrong.

I can't separate the parts easily and we don't use a tool like Github that keeps an exact track.

programming practices: ethics / legality of the copy and paste code of the repository of a proprietary software owned by the company in a personal repository?

Let's say I discover how to do something while writing code for a company's software at the company's time.

Code.lang file:

if (very complicated logic) {

This "Code.lang" file is part of the repository that I-u-other-person wrote for the repository to execute an implementation. In addition, the syntax is unique, since it is the only way to execute the implementation in a specifically required manner given the framework / language.

I have two options:

  1. I can try to rewrite it from memory, which, if complicated, will be very difficult. Most likely, I will have to repeat some or all of the research I did when writing this initially.

  2. Or I can simply go to GitHub / Bitbucket / etc. repository, click on the file and copy and paste the code from there. Then, I would simply change whatever is necessary to make it work with my personal repository.

What are the ethical / legal implications of carrying out any of these practices?

Best practices in the information position on tools

It is also about the recent position of the item (tool information is attached) on the screen.

When it is at the top and the tooltip appears at the top, it could be off the screen. Example:

Example 1

Better solution, when the item is at the top of the screen, then display the tooltips at the bottom:

Example 2 Solution

The same goes for the items at the bottom of the screen, then it shows the tooltips at the top.

By the way, I am using the tooltip library: https://github.com/q2apro/webui-popover