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.

Separar rangos numericos

publicado

Buen Día Amigos:

Tengo la siguiente inquietud: existe algun macro para separar rangos numericos del tipo: "1-5, 7, 9-11 " si este estuviese en la celda A1 convertirla en la celda A2 en: 1,2,3,4,5,7,9,10,11 para que quede algo como la imagen adjunta.

saludos

[ATTACH]36372.vB[/ATTACH]

post-78744-145877006853_thumb.jpg

Featured Replies

publicado

Hola:

Pruebe con esta macro:

Sub GenerarNúmeros()

Dim Cadena, Fila, Series, Intervalos
Cadena = Range("A1")
Range("A:A").ClearContents
Range("A1") = Cadena
Fila = 2
Series = Split(Cadena, ",")
For s = 0 To UBound(Series)
Intervalos = Split(Series(s), "-")
d = Intervalos(0)
h = d
If UBound(Intervalos) = 1 Then h = Intervalos(1)
For n = d To h
Range("A" & Fila) = n
Fila = Fila + 1
Next
Next

End Sub
[/CODE]

Saludos

publicado

Hola! Juan (y Gengis)

Te adjunto otra forma de encarar el tema:

Sub Separa_rangos_numéricos()
Dim misRangos, misExtremos, i%, j&, k&
Application.ScreenUpdating = False
Intersect([a:a], [a1].CurrentRegion).Offset(1).Delete xlShiftUp

misRangos = Split([a1], ",")
For i = 0 To UBound(misRangos)
misExtremos = Split(misRangos(i), "-")
j = misExtremos(0): k = misExtremos(UBound(misExtremos))
Cells(Rows.Count, "a").End(xlUp).Offset(1).Resize(1 + k - j) = _
Evaluate("row(" & j & ":" & k & ")")
Next i

Application.ScreenUpdating = True
End Sub[/PHP]

Saludos, Cacho R.

publicado
  • Autor

Muchas Gracias a los dos, Gengis y Cacho: los dos codigos funcionan a la perfeccion.

Este tema esta solucionado.

Saludos

publicado
... los dos codigos funcionan a la perfección ...

Era "natural" que ambos códigos te funcionaran a la perfección: al mío le falto "esto" para constituir un hurto del de Gengis ( :highly_amused:jajajaja).

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.