vba code modification

Dayski147

Banned user
Joined
Apr 12, 2022
Messages
89
Office Version
  1. 2016
Platform
  1. Windows
I want the line in red color instead of moving to the A5 box, moving to the last line with writing

After the migration it clears the page from which it was migrated from Store Issue from the first data from cell A5




sub gg ()

Set Sh = Sheets("Store Issue")
Sh.Select
Dim Arr(1 To 1)
'======================================================
End_Row = Sh.Cells(Rows.Count, "a").End(xlUp).Row
Set Rng = Sh.Range("a4:g" & End_Row)
'======================================================
Arr(1) = "Store Issue (2)"
Application.ScreenUpdating = False
'======================================================
'Call Clear_Class
For Class = 1 To 1
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
ActiveSheet.AutoFilterMode = False
End If
'======================================================

Rng.AutoFilter Field:=7, Criteria1:=Arr(Class)
Set Rng_1 = ActiveSheet.AutoFilter.Range.Offset(2).Resize(ActiveSheet.AutoFilter.Range.Rows.Count - 1)

Rng_1.Copy Sheets(Arr(Class)).Range("A5")

Application.CutCopyMode = False
'======================================================
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
ActiveSheet.AutoFilterMode = False
End If
'======================================================
Next
'======================================================
'Call Hide_Columns_In_Range
'======================================================
Application.ScreenUpdating = True
'
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Both of these are placed in a routine module. One macro deletes macro located in a Sheet module .... the other deletes macro located in a routine module.

VBA Code:
Option Explicit

'Reference : "Microsoft Visual Basic For Applications Extensibility"

Sub RemoveSheetModule()
    Dim wb     As Workbook
    Dim md     As Module
    Dim str    As String
  
    Application.ScreenUpdating = False
        Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & "URL Check - Copy.xlsm")
      
        For Each md In wb
            Select Case md.Name
                Case "Module1"
                    str = md.CodeName
                    With wb.VBProject.VBComponents(str).CodeModule
                        .DeleteLines 1, .CountOfLines
                    End With
                Case Else
            End Select
        Next md
      
        wb.Close True
    Application.ScreenUpdating = True
  
    MsgBox "Done...", 64
End Sub

Sub delModMacro()
Dim wb As Workbook
 Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & "CommandButton.xlsm")
    With wb.VBProject.VBComponents("Module1").CodeModule   '<--- change to ThisWorkbook for that module

            .DeleteLines 1, .CountOfLines

    End With
    
 MsgBox "Done...", 64
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,589
Messages
6,120,416
Members
448,960
Latest member
AKSMITH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top