Help with 2 steppermotors controlled by potentiometers

Works for me.

I'd probably make the UI more responsive by moving the pot reading and screen updating out of the on/off conditionals so you could see the adjustments as you move the pots:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
//#include <Stepper.h>
#define directionPin1 2
#define stepPin1 3
#define potentiometerPin1 A0
#define switchPin1 7
#define directionPin2 4
#define stepPin2 5
#define potentiometerPin2 A1
#define switchPin2 6
LiquidCrystal_I2C lcd(0x27, 16, 2);
int previousPotValue1 = 0;
int previousPotValue2 = 0;
//-----------------------------------------------------------------
void setup() {
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Speed M1: ");
  lcd.setCursor(12, 0);
  lcd.print("  % ");
  lcd.setCursor(0, 1);
  lcd.print("Speed M2: ");
  lcd.setCursor(12, 1);
  lcd.print("  % ");
  // Serial.begin(9600);
  pinMode(switchPin1, INPUT_PULLUP);  // Schakelaar 1 heeft een pull-up weerstand
  pinMode(switchPin2, INPUT_PULLUP);  // Schakelaar 2 heeft een pull-up weerstand
  pinMode(directionPin1, OUTPUT);
  pinMode(stepPin1, OUTPUT);
  digitalWrite(directionPin1, LOW);
  pinMode(directionPin2, OUTPUT);
  pinMode(stepPin2, OUTPUT);
  digitalWrite(directionPin2, LOW);
  //Serial.begin(115200);
}
//-----------------------------------------------------------------
void updateLCD(float speedPercent1) {
  lcd.setCursor(10, 0);
  lcd.print(speedPercent1, 0);
  lcd.print(" ");
}
//-----------------------------------------------------------------
void updateLCD1(float speedPercent2) {
  lcd.setCursor(10, 1);
  lcd.print(speedPercent2, 0);
  lcd.print(" ");
}
//-----------------------------------------------------------------
void loop() {
  // Stepper motor 1
  int potValue1 = analogRead(potentiometerPin1);
  int potValue2 = analogRead(potentiometerPin2);

  float speedPercent1 = map(potValue1, 0, 1023, 100, 10);  // Calculate speed percentage for motor 1
  //Serial.println(speedPercent1);
  //Check if potentiometer 1 value has changed by more than 2%
  if (abs(potValue1 - previousPotValue1) > 10) {
    updateLCD(speedPercent1);
    previousPotValue1 = potValue1;
  }
  int delayTime1 = map(potValue1, 0, 1023, 100, 1000);  // Adjust these values according to your motor and preference

  float speedPercent2 = map(potValue2, 0, 1023, 100, 10);  // Calculate speed percentage for motor 2
  // Check if potentiometer 2 value has changed by more than 2%
  if (abs(potValue2 - previousPotValue2) > 10) {
    updateLCD1(speedPercent2);
    previousPotValue2 = potValue2;
  }
  int delayTime2 = map(potValue2, 0, 1023, 100, 1000);  // Adjust these values according to your motor and preference

  if (digitalRead(switchPin1) == LOW) {
    digitalWrite(stepPin1, HIGH);
    delayMicroseconds(delayTime1);
    digitalWrite(stepPin1, LOW);
    // delayMicroseconds(delayTime1);
  } else {
    digitalWrite(stepPin1, LOW);
  }
  // Stepper motor 2
  if (digitalRead(switchPin2) == LOW) {
    digitalWrite(stepPin2, HIGH);
    delayMicroseconds(delayTime2);
    digitalWrite(stepPin2, LOW);
    // delayMicroseconds(delayTime2);
  } else {
    digitalWrite(stepPin2, LOW);
  }
}