Excel Macro Newbie in need of help

KaP76

New Member
Joined
Sep 1, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hello dear community,

I am totally a newbie with macros on excel but would really appreciate your support and genius minds.

The task is not the easiest (for me definitely not), what I would need this beautiful Macro to do is:

First Save a new version of the excel as an excel (xlsm i guess)
Open that excel
Perform a couple of actions such as copy paste values and delete tabs.

I'm sure that it's much easier than i've done here so please feel free to completely re-adjust, I'm sure 80% of it is wrong as I copied it from a Excel to PDF macro. The only thing that really works right now is the green text as i manually recorded it.

Sub Macro5()
'
' Macro5 Macro
'
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant

Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
strTime = Format(Now(), "dd.mm.yyyy")


'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & "\"

'create default name for savng file

strFile = Replace(ActiveWorkbook.Name, ".xlsm", "") & strTime
strPathFile = strPath & strFile

'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename
ActiveWorkbook.SaveAs Filename & ".xlsm", FileFormat:=52

Range("B3:K10").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("M:AB").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Sheets("5) Client Summary").Select
Range("B6:E6").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets(Array("1) General", "2) Suppliers", "3) RFP", "4) RFP Control", _
"7) Budget Control", "Links to Master")).Select
Sheets("2) Suppliers").Activate
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Delete


exitHandler:
Exit Sub
End Sub


Thank you so very much in advance,
Kallia
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
If it helps I have 8 tabs and i need to keep only 2 :)
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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