Page 1 of 3 123 LastLast
Results 1 to 15 of 40
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    move cursor in cells (2000 sr 1)

    I get a value into sheet DATE with this piece of macro. I would want to add another controll in this mode:

    GG = Mid(Sheets("DATE").Cells(2, 2), 1, 2)
    MM = Mid(Sheets("DATE").Cells(2, 2), 4, 2)
    AA = Mid(Sheets("DATE").Cells(2, 2), 7, 4)

    I would want to add another var into code MESE and DECADE.
    If the var MESE = 2 is refered to FEBBRAIO (Febrary) into sheet DATE (range A), if the var DECADE is "1" or "2" or "3" is refrered DECADE (range B, C, D)

    i want similrar this

    GG = Mid(Sheets("DATE").Cells(MESE , DECADE ), 1, 2)
    MM = Mid(Sheets("DATE").Cells(MESE , DECADE ), 4, 2)
    AA = Mid(Sheets("DATE").Cells(MESE , DECADE ), 7, 4)


    how to make this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: move cursor in cells (2000 sr 1)

    Try

    GG = Mid(Sheets("DATE").Cells(MESE + 1, DECADE + 1), 1, 2)

    and similar for the other two.

    Explanation:
    MESE = 1 (Gennaio) corresponds to row 2, MESE = 2 (Febbraio) corresponds to row 3, etc.
    DECADE = 1 corresponds to column B (the 2nd column), DECADE = 2 corresponds to column C (the 3rd column) etc.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    WORK PERFECT!,
    But how to understand me? I write with a terrible english!

    is possible to use the same strategy for this:

    I insert variuos value with this piece of code refered the sheet attached, in this code the range are fixed from C to E...
    i would want to move based the cells into line 1 of sheet DECADE.

    for eample assuming the var NUMERO_MESE = 2 select M2 and if the var NUMERO_DECADE = 3 select the range S to U...


    'SK-2001/SK-2002/SK-6002 - PRIMA DECADE

    If Sess0.SCREEN.GETSTRING(8, 33, 1) = "_" Then
    Sheets("DECADE").Range("C" + RIGA) = ""
    Else
    Sheets("DECADE").Range("C" + RIGA) = Sess0.SCREEN.GETSTRING(8, 33, 8)

    End If

    If Sess0.SCREEN.GETSTRING(9, 33, 1) = "_" Then
    Sheets("DECADE").Range("D" + RIGA) = ""
    Else
    Sheets("DECADE").Range("D" + RIGA) = Sess0.SCREEN.GETSTRING(9, 33, 8)

    End If

    If Sess0.SCREEN.GETSTRING(10, 33, 1) = "_" Then
    Sheets("DECADE").Range("E" + RIGA) = ""
    Else
    Sheets("DECADE").Range("E" + RIGA) = Sess0.SCREEN.GETSTRING(10, 33, 8)

    End If

    'SK-2001/SK-2002/SK-6002 - PRIMA DECADE

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: move cursor in cells (2000 sr 1)

    You could use something like this:

    Dim Colonna As Long
    Colonna = 10 * Numero_Mese + 3 * Numero_Decade - 10

    and instead of Range("C" + RIGA), use Cells(Riga, Colonna)

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    No dubt you are a genius!

    But to understand... why you have used *...
    Is possible a little exaplain.
    Tks

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: move cursor in cells (2000 sr 1)

    Each month is 10 columns to the right of the previous month, so we multiply the month number by 10.
    Each decade within a month is 3 columns to the right of the previous decade, so we multiply the decade number by 3.
    Finally, we have to subtract something to start in the correct column. For the first decade of January, 10 * mese + 3 * decade = 10 + 3 = 13. This decade starts in column 3, so we must subtract 10.

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    Tks Professor!

  8. #8
    2 Star Lounger
    Join Date
    Sep 2002
    Location
    Birmingham, England
    Posts
    123
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    >>But how to understand me? I write with a terrible english!

    He second-guesses you, Sal21. And most of the rest of us.
    Look up the word 'spooky' in a dictionary?

  9. #9
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    Assuming i use this sheet (attached into first thred of this post move_by_month.xls) possible to insert a button to:

    1) Show a userform

    2) In this userform insert 3 Listbox

    3) list box 1 - Listing the value into column A range A2:A13 (or fill with the normal month) and assign to the var NUm_mese the selected value from the list box in this mode:
    if i select Febbraio from list assign to the var NUm_mese "02", if i select Marzo from list assign to the var NUm_mese "03....ecc..

    4) list box2 - is filled with the related decade value in refrence to the month:

    Example:

    I selct into list box 1 i select the month Febbraio listing the date of decade

    10/02/2005 (is 1 DECADE, assign the value 1 to the var Num_decade)
    20/02/2005 (is 2 DECADE, assign the value 2 to the var Num_decade)
    28/02/2005 (is 3 DECADE, assign the value 3 to the var Num_decade)

    In this case not is possible to make error when is selected the the decade from month

    5) list box 3 - listing a value similar TIPO01, TIPO02, TIPO03 ecc... and assign to the value selected a value into var Num_Tipo the numerical value TIPO01 var Num_Tipo ="01" ecc...

    Tks.

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: move cursor in cells (2000 sr 1)

    Yes, it is possible, but you will have to make the userform yourself, Sal.

  11. #11
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    Hi Hans, good morning...
    have mked a test... (3 Hours...)

    Difficult to assign to the var Into combo box 3 the real value of various item... example for 01-GIORNALIERA assign 01, for 04-DECADALE assign 04, ecc....

    01-GIORNALIERA
    04-DECADALE
    05-QUINDICINALE
    06-MENSILE
    08-TRIMESTRALE
    10-SEMESTRALE
    11-ANNUALE

  12. #12
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: move cursor in cells (2000 sr 1)

    Use Left(ComboBox3, 2) to extract the first two characters.

  13. #13
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    Hans, sorry...

    Fired!!!

    Asuming have this new sheet MENSILE, wath is the formula refered COLONNA

    Here is the old....

    COLONNA = 10 * NR_MESE + 3 * NUMERO_DECADE - 10

    Tks for patience.

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: move cursor in cells (2000 sr 1)

    There are no decades in this worksheet...

  15. #15
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: move cursor in cells (2000 sr 1)

    yes only a block of 4 column per Month...

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •