Run this code on a copy of your file
Sub Delete_All_Y()
Dim sht As Worksheet
On Error GoTo ErrHandler
Set sht = ThisWorkbook.Worksheets("Sheet1")
ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table3").Sort.SortFields.Clear...
Try this code to go to A372
Dim sht As Worksheet
Dim LastRow As Long
Set sht = ThisWorkbook.Worksheets("Sheet1")
LastRow = ActiveSheet.Range("A65536").End(xlUp).Row
Cells(LastRow, 1).Select
This might be what you want :-
( Use on a copy of your file )
Sub MoveUp_5_Cells()
Dim Last_Row As Long
Dim i As Long
Last_Row = ActiveSheet.Range("A65536").End(xlUp).Row
Do Until Last_Row = 1
If Cells(Last_Row, 1).Value > 2016 And Cells(Last_Row, 2) > 15 Then
Cells(Last_Row, 1).Resize(...
Would something simple like this work for you ?, Change "C" to your column
Sub Remove()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Column("C").EntireColumn.Delete
Next ws
End Sub
Try this code:-
Sub DeletRowsAbove()
Dim last As Long
Dim x As Long
With ActiveSheet
last = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
For x = last To 2 Step -1
If Cells(x, 1).Value = "Slovakia" Then
Cells(x - 1, 1).EntireRow.Delete
End If
Next x
End With
End Sub
For 2) Delete rows from A1:A25, Try this code.
Sub sbVBS_To_Delete_Blank_Rows_In_Range()
Dim iCntr
Dim rng As Range
Set rng = Range("A1:A25")
For iCntr = rng.Row + rng.Rows.Count - 1 To rng.Row Step -1
If Application.WorksheetFunction.CountA(Rows(iCntr)) = 0 Then Rows(iCntr).EntireRow.Delete...
And for 7) Autofit the data in all columns, try this code
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.ScreenUpdating = False
For Each Value In Target.Columns
Worksheets(Sh.Name).Columns(Value.Column).AutoFit
Next Value
Application.ScreenUpdating...
Any ideas as to why .accdb gives an error and .mdb works in this code ?
Sub accessimport()
Dim db As Database
Dim ws As Workspace
Dim acsql As String
Dim recSet As DAO.Recordset
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase _
("C:\Users\wewe\Desktop\Rating Data for Excel v1.accdb")...
Try this :-
Sub ListTables()
Dim tbl As ListObject
Dim WS As Worksheet
Dim i As Single
i = 1
For Each WS In Worksheets
For Each tbl In WS.ListObjects
Range("A1").Cells(i, 1).Value = tbl.Name
i = i + 1
Next tbl
Next WS
End Sub
Try this code to sort and delete non 1 rows,
Sub SortColQ()
Dim Lastrow As Long
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "Q").End(xlUp).Row
End With
Range("Q13:Q" & Lastrow).Select
Application.AddCustomList ListArray:=Array("1")...
Narayan
Thanks it works.
Range("A1").Offset(LastRow - 1).Formula = "=B" & LastRow & " & " & """ """ & " & " & "C" & LastRow
This is what i wanted rather than the
Range("A2").Resize(LastRow - 1).Formula = "=B2 &"" ""& C2"
That I was using.
Its working, I just want to learn how to ONLY fill ONE formula on each side of the new data rather than refilling up all of the columns each time from A2 and E2.