Saltar al contenido

How to Make the First Issue of the Past Month Appear as (26) which was on Monday


Recommended Posts

Hello everyone from Maurizio
My problem is this .
I'm trying but failing to want to create some sort of Calendar
Slo that my problem with the vba is this:
in a userform I inserted a Textbox and Seven Labels, of which 6 are classified as (Cella1,Cella2,Cella3) etc...!
And I want them to stay that way.

While a label the name has remained unchanged and is called (Label3)

Now what I would like to get from vba code, and that every time I start the userform the Labels classified as (Cella1 etc ...! the number "26" is reported which corresponds to the number of the month of December which was (Monday ) and gradually all the other ends to reach (1) of the following week which corresponds to the Number of the beginning of this month.

In addition, if it were possible, I would like to be able to make the start date of the month appear in (Label3) as a code, as I manually reported, to better understand "01/01/2023"

Clearly if I change the date in the Texbox these data must be able to change accordingly.

I don't expect you to do all the work for me It would be enough for me
just to see the Number (26) appear in the label (Cella1) and the start date of the month in (Label3)
Thank you
Greetings from A.Maurizio

Numero_Setimana_Inizio_Mese.xlsm

Enlace a comentario
Compartir con otras webs

Ciao Antony
Ascolta ho pensato che avrei potuto da qui in poi per poter risolvere il mio problema seguendo le tue direttive; Che come sempre sono fantastici.
Ma ho provato a dargli altre direttive, ma non funziona come vorrei.
Quindi ascolta: potresti dare un'occhiata al mio file
excel e provare a fare la stessa cosa solo usando il vba all'interno del modulo .

Mi spiego: sul foglio Excel nella colonna (A1:A5) avevo estratto tutti i dati necessari per formare un calendario molto semplice.
Facendo così:

1) data odierna (=Ora())2) L'anno (=Anno(A1))3) Inserisco l'anno come testo e lo trasformo come inizio del mese (01/01/2023 )

utilizzando questa funzione (=DATA(A2; A4;1))
4) Estraggo la media Dalla data odierna (=DATA(A2; A4;1))
5 ) Infine estraggo il numero del giorno della settimana
Dall'inizio del mese mese che è uguale a "26" ( = MESE(A1))

Il resto delle celle del foglio Excel mostra i vari numeri del mese seguendo questa logica:nella cella (B4) che corrisponde al "26" Giorno del mese precedente ho scritto( =(A3-WEEKDAY(A3,3))Pur partendo dalla Cella (C4) e gradualmente per tutte le altre ho appena scritto
:

(=B4+1)
; (=C4+1) ; (=D4+1) ecc...!

Ora quello che vorrei sapere è se fosse possibile a livello di modulo; Ma senza collegamenti al foglio Excel.
Essere in grado di ripetere la stessa cosa con il vba.

Questo è tutto?
Sto pubblicando il mio lavoro fatto qualche tempo fa a livello di foglio; Quindi puoi dargli un'occhiata più da vicino E se fosse
possibile, non potresti non usare l'etichetta (Dynamics)
Ma solo chiamandoli (Cell1); (Cella2) ecc...!
Grazie. Sei fantastico come sempre.
Saluti da Maurice

 

Calendario Per Enrico.xlsm

Enlace a comentario
Compartir con otras webs

Hi Haplox Thanks for your support
And this work is beautiful
But it's far from what I want to do, I just lack the initial steps to get all that basic information.
That's all
Thanks again for everything both you and Antoni
I'll try to better understand what the difference is between the vba and the formulas entered on the excel sheet.
Thanks again for everything and above all thanks for your time that you have dedicated to me.
Greetings to rurri with Friendship from A.Maurizio

 

Enlace a comentario
Compartir con otras webs

Hi Antony
Not !
I would like to get a calendar on a form exactly as you proposed
only instead of moving the boxes of the names of the Week (Mon);(Tue);(Wed) etc...!
Make the numbers move only within the various Boxes exactly as you see in my calendar Proposed on the excel sheet.
Only that you should repeat the same thing but only in the form.

Another small example: I managed to put all the items you see in the column of the excel sheet ranging from (A1:A4) using only a Text to change the date from time to time.
Three Labels For (Day Month Year)
and a last Label which shows the date of the beginning of the current month.
Example: If today the date is shown in the text (01/17/2023) the last label is written like this (01/01/2023)
Now where is the problem !
That in the first label that makes up the scheme of our calendar; Exactly as you see it on the excel sheet
Because everything can work well even in the form
You should understand how to write this Code in vba format:" =A3-(WEEKDAY(A3,2)-1) "
Which in a nutshell would mean:
Get the number of the month that is on the Month label
Subtract it from the Day of the Week
And you transform it from the text format to the number 2 which corresponds to the day Of (Monday) minus 1 which to tell the truth I didn't quite understand why the excel formula you want it done this way that's all!
A bit like you can see in the image below

Only in this case it's at the level of the excl sheet
While I would like to do exactly that only using a form with its cells as labels

Link Project Now :
https://app.box.com/s/3nbyn726mwpduitfblk9ejlm35v8f0ll

Enlace a comentario
Compartir con otras webs

  • 2 weeks later...

Hi Anthony how are you!
As always, you have outdone yourself

as your project is Beautiful and there is much more
As I noticed that: if you click on a Date it Generates Another Calendar
And all of this is wonderful
Thanks Infinite
Greetings to you and all the rest of your AyudaExcel Staff
From A.Maurizio

Enlace a comentario
Compartir con otras webs

Archivado

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

  • 97 ¿Te parecen útiles los tips de las funciones? (ver tema completo)

    1. 1. ¿Te parecen útiles los tips de las funciones?


      • No
      • Ni me he fijado en ellos

  • Ayúdanos a mejorar la comunidad

    • Donaciones recibidas este mes: 0.00 EUR
      Objetivo: 130.00 EUR
  • Archivos

  • Estadísticas de descargas

    • Archivos
      177
    • Comentarios
      90
    • Revisiones
      27

  • Crear macros Excel

  • Mensajes

    • Hola, Ya he podido, reoslverlo. Por favor dar por terminado, este tema. Muchas gracias Mariano
    • Buenas a todos, trato de transponer o pivotar el archivo que adjunto. El archivo tiene 3 columnas ( en este caso, como pueden ser más 😞 Cód.artículo, Cód.características y Valor. El objetivo es dejar como primera columna el Cód.artículo y como fila de encabezado Cód.características, y luego cruzando datos con Valor. No sé si me he explicado bien Gracias de antemano. Libro1.xlsx
    • Hola que tal amigos programadores por favor me podrían ayudar con una macro que me genere un archivo CSV delimitado por comas, la estructura del archivo CSV no deberá llevar encabezado, los datos del archivo CSV serán obtenidos de la hoja “Datos”. En la columna A: deberá tener la clave clues que se toma de la columna B de la hoja Datos En la Columna B: el Código (son 230 codigos que van del rango G1:IB1 de la hoja datos) En la Columna C: el valor almacenado a su correspondiente al código y clues En la Columna D: el número del mes que se obtendrá de la de la columna E de la hoja Datos En la Columna E: el año que se tomará de la columna F de la hoja de Datos   Son 230 códigos por lo que la macro generará 230 filas por cada clave clues que tenga la hoja Datos En el archivo anexo una hoja llamada CSV para que vean la estructura que tendrá, el archivo CSV estará delimitado por comas   Les agradecería mucho que me ayuden por favor, Dios los bendiga Exportar datos a csv.xlsx
    • Hola buenas tardes.   Debido al trabajo debo estar comparando en un periodo unos archivos dentro de una carpeta o subcarpeta. en base a la fecha de creacion o modificacion.  pero tengo que estar viendo carpeta por carpeta y aveces son varios. Con una macro intente  listar los archivos de cualquier carpeta y subcarpeta, esto activandolo segun la celdaactiva. El problema es que tiene algunos errores. 1. si la carpeta cuenta con subcarpetas me los manda a muchas filas abajo. Mi idea es hoja(Así debe quedar) Que con una macro pueda seleccionar la carpeta desde el buscador y me de la lista de archivos a partir de la fila 6. siendo columna A= fecha de modificación, columna B =Fecha de creación y columna C=Nombre del archivo con hiperlink. Con otro o con la misma macro poder seleccionar otra carpeta y sus subcarpetas, según sea el caso. y me liste a partir de la columna F de la fila 6 Siendo La columna F=Nombre del archivo, columna H=fecha de creación, columna I=ultima modificación   Para así poder acceder y comparar mis archivos, directamente desde excel.   Muchas gracias Mariano       Listar archivos de 2 carpetas para comparar.xlsm
    • Hola buenas, Os presento mis dudas. Tengo un libro  (llamémosle LibroDestino) con dos módulos, uno de definición de variables "ModDef" y otro de inicializacion de esas mismas variables "ModCfg". Necesito que al copiarme una hoja de otro libro(llamémosle LibroOrigen), mediante un procedimiento, sobrescribir el modulo de inicialización de variables del LibroDestino con el  contenido del módulo que hay en el LibroOrigen. Destacar que los dos módulos de cada libro tienen el mismo nombre "ModCfg". Y tienen una única variable llamada "Mensaje". En el LibroDestino tiene el valor "Hola" y en el LibroOrigen el valor "Adiós" Este procedimiento lo realiza perfectamente,  es decir se sobrescribe, pero si en el mismo procedimiento quiero utilizar el nuevo valor de esa variable, me conserva el valor de la variable anterior. Para hacer las comprobaciones he ejecutado un MsgBox al empezar y al acabar el procedimiento, pero en los dos casos me devuelve el valor original del LibroDestino el valor "Hola", cuando mi idea es que al sobrescribir el modulo con el nuevo valor de la variable, el último MsgBox me devuelva el valor "Adios". Mi objetivo es poder tener la inicialización de esas variables en un libro que no sea el de trabajo (LibroDestino), ya que según la hoja que importe puedo requerir que las variables tengan un valor u otro. ¿Por que no me coge en el procedimiento el nuevo valor de la variable? ¿Cómo podría conseguirlo? He tenido que activar en VBA  la referencia Microsoft visual basic for applications extensibility 5.3 desde  Herramientas -> Referencias. Creo que es la única manera de poder trabajar con los módulos desde VBA, aunque si se pudiera de otra manera creo que sería mas óptimo. Mil gracias de antemano, un saludo!         Libro1_Prueba.xlsm Libro2_Prueba.xlsm
  • Visualizado recientemente

    • No hay usuarios registrado para ver esta página.
×
×
  • Crear nuevo...

Información importante

Echa un vistazo a nuestra política de cookies para ayudarte a tener una mejor experiencia de navegación. Puedes ajustar aquí la configuración. Pulsa el botón Aceptar, si estás de acuerdo.