+ Reply to Thread
Results 1 to 10 of 10

update values between sheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    update values between sheets

    Hi to all,
    in the attached workbook you have to do this
    in "articoli" sheet
    IF E6 < J6 OR E6 = J5
    bring the row into the sheet "sotto_scorta"
    I hope I have explained
    thanks
    john
    Attached Files Attached Files
    Last edited by john_cash; 01-14-2021 at 05:06 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,656

    Re: update values between sheets

    try such macro:
    Sub passare_a_sotto_scorta()
    Dim i As Long
    Application.ScreenUpdating = False
    With Sheets("articoli")
      For i = .Cells(.Rows.Count, "A").End(xlUp).Row To 6 Step -1
        If .Cells(i, "E") <= .Cells(i, "J") Then
          .Rows(i).Cut Sheets("sotto_scorta").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).EntireRow
        End If
      Next i
    End With
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    Re: update values between sheets

    Hi kaper, thank you
    A change:
    in the "articoli" sheet the lines must remain in the same place, they must not be eliminated

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: update values between sheets

    Sub passare_a_sotto_scorta()
        Dim i As Long
        Application.ScreenUpdating = False
        Sheets("sotto_scorta").Cells(2, 1).Resize(10000, 12).ClearContents
        With Sheets("articoli")
            For i = 6 To .Cells(.Rows.Count, "A").End(xlUp).Row
                If .Cells(i, "E") <= .Cells(i, "J") Then
                    .Rows(i).Copy Sheets("sotto_scorta").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).EntireRow
                End If
            Next i
        End With
        Application.ScreenUpdating = True
    End Sub

  5. #5
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    Re: update values between sheets

    Ops kaper
    i changed here

    .Rows(i).Copy Sheets("sotto_scorta").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).EntireRow

  6. #6
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    Re: update values between sheets

    Thanks also to mohadin

  7. #7
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    Re: update values between sheets

    I tried the kaper macro in another workbook.
    must copy the non-blank rows of column B
    Attached Files Attached Files

  8. #8
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,656

    Re: update values between sheets

    Try:
      For i = 6 to .Cells(.Rows.Count, "A").End(xlUp).Row 
        If .Cells(i, "E") <= .Cells(i, "J") And Len(.Cells(i, "B")) > 0 Then
          .Rows(i).Copy Sheets("sotto_scorta").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).EntireRow
        End If
      Next i
    Non-empty part is marked with red. I also changed the sequence of copyint to top=to bottom one (blue) as you are not moving, but copying rows. (For moving bottom to top was easier to implement.)

  9. #9
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    Re: update values between sheets

    Hi kaper the macro works almost fine.
    I linked the macro to a button and clicking on the button
    the rows in the sheet "sotto_scorta" are repeated.
    Another thing:
    it is possible that the rows are brought into the sheet "sotto_scorta"
    without colors, formatting
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    10-31-2018
    Location
    venezia
    MS-Off Ver
    2007
    Posts
    488

    Re: update values between sheets

    I solved it by adding macros created with the recorder:
    Option Explicit
    
    
    Sub passare_a_sotto_scorta()
    
    Dim i As Long
    
    Application.ScreenUpdating = False
    
    Call elimina_righe
    
    With Sheets("articoli")
    
        
       For i = 6 To .Cells(.Rows.Count, "A").End(xlUp).row
        If .Cells(i, "E") <= .Cells(i, "J") And Len(.Cells(i, "B")) > 0 Then
          .Rows(i).Copy Sheets("sotto_scorta").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).EntireRow
        End If
      Next i
      
    End With
    
    Call togli_colore
    Call togli_formattazione
    
    Application.ScreenUpdating = True
    
    End Sub
    
    
    
    Sub elimina_righe()
    
        Rows("4:200").Select
        Selection.Delete Shift:=xlUp
        
        Range("A4").Select
        
    End Sub
    
    
    Sub togli_colore()
    
        Rows("4:200").Select
        With Selection.Interior
            .Pattern = xlNone
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
        
        Range("A4").Select
        
    End Sub
    
    
    
    Sub togli_formattazione()
    
        Cells.FormatConditions.Delete
        
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Multiple sheets select based on values in sheets, save to pdf, code update
    By vendam in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2020, 11:37 AM
  2. [SOLVED] Cut/Paste and Update Values between two sheets (losing rows)
    By picsou in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2019, 09:01 AM
  3. Problem linking sheets to update stock values
    By XBookNoob in forum Excel General
    Replies: 2
    Last Post: 11-23-2018, 04:00 PM
  4. [SOLVED] Update values on 1 sheet with values from multiple source sheets
    By Jean Claude Baptiste in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2017, 04:56 PM
  5. update list with specific cell values in uncreate sheets (templates)
    By dmendes in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-19-2013, 03:48 AM
  6. Can cell formatting be linked to other worksheet?
    By ibbylibby in forum Excel General
    Replies: 0
    Last Post: 09-06-2012, 06:41 AM
  7. [SOLVED] Macro to auto Update values in different sheets
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2012, 04:24 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1