Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Macro para crear hoja si no existe

publicado

Buen día a todos;

-Adjunto una macro que sí la hoja no está creada me la crea.

Esto lo hace con la "Function ExisteHoja"

Para que funcione tengo que nombrar las hojas como: Hoja1,Hoja2, etc... y yo las tengo nombradas de forma personalizada.

¿No sé si esto es posible?.

 

Saludos.

MHojaName.xlsm

Featured Replies

publicado
Sub crearHoja()
Dim Hoja As String

Hoja = "Benito" '<---------- Tu hoja nueva

If ExisteHoja(Hoja) Then
   MsgBox "Ya existe la hoja " & Hoja, vbCritical
Else
   Sheets.Add(After:=Sheets(Sheets.Count)).Name = Hoja
   MsgBox "Se ha creado la hoja " & Hoja, vbInformation
End If
End Sub

Function ExisteHoja(Hoja As String) As Boolean
For h = 1 To Sheets.Count
   If Sheets(h).Name = Hoja Then
      ExisteHoja = True
      Exit Function
   End If
Next h
End Function

 

publicado
  • Autor

Bo día e gracias Antoni;

He estado viendo la macro y me faltó la variable Hoja="Nombre" y ponerla en el condicional de la Función.

Me estaba despistando el ciclo For.

Lección aprendida.

Un abrazo y saludos a la Capital.

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.