So I have received some awesome guidance with codes and directions to try as I continue to learn and grow in VBA and Macros. I recorded a physical macro which preps and cleans up data from a data file then imports specific columns of data to my workbook.
I was thinking it might be cleaner to...
Hi All,
I need a script that will delete sheets based on an earlier calculation. TabDiff2 is defined earlier.
I have the following code which is breaking:
For v = TabDiff2 To 1 Step -1
Sheets("2_Weightings").Index -v.Select
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete...
Hi.
Got a question.
I got a timer that counts from 1 min down, then runs a Sub called shutdown.
The problem is, when it closes, it leaves a open empty excel program open, not completely shutting it down, i fixed this with the code under, but if i got a other workbook active, it asks that to...
Hi Team,
Happy Friday!
I am using following VBA code to close only the workbook I am working on, but this code closes all workbooks which have been opened. Any idea, please.
Dim WbCount As Integer, ii As Integer
WbCount = Workbooks.count
If WbCount > 1 Then
For ii = WbCount To 1 Step...
Can anyone help me with the following code i wrote:
It only saves the first sheet.
Sub copysheet()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ActiveSheet.Copy
wb_name = ActiveSheet.Name
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _...
Hi Guys,
I hope you can help -
The below is something I have built out to grab data from about 90 workbooks. The challenge I have is I need to run this each week as the data updates however this duplicates the data and I would like it to avoid this so that it only reports on the latest data...
I am using the code at the end of this post to make the sheet autosave every x minutes. The autosave function works perfectly.
The issue is if there is another excel file open at the time of close the autosave sheet reopens at the time it would have saved.
There is another excel file that...
I have a code I've been working on to open files in a folder and see if they meet certain criteria. If so it copies it to another sheet where I am organizing the data I want. The issue I am having is when it finds a file that does not meet the criteria it just ends the code and doesn't continue...
In trying to delete a sheet, I constantly get run-time error 9. I think the reason is because the code called to delete the sheet originates from within a button on the sheet; kinda-sorta like suicide prevention.
To Try to avoid this, I placed code in the activate event of another sheet and...
Hi folks,
My code populates 5 sheets before making a copy for a new workbook, then save as, then email.
The save as part is very slow. I've stepped through it and it lags for 30 seconds.
Has anybody seen this before? I haven't had much luck on google.
All help appreciated!
This is the...
I'm using this to loop through cells containing hyperlinks to websites and if criteria is met open that page;
Application.DisplayAlerts = FalseFor Each Cell In Sheet11.Range("J2:J19")
If Cell.Value = "YES" Then
If Cell.Offset(0, 3) > 13 Then
ThisWorkbook.FollowHyperlink Cell.Offset(0, -7)...
Hi all, getting this expected expression error, it's highlighting the IF part, though I don't know why:
Sub FinalEnqCopydown()
'
' Copydown Macro
'
'
If ActiveCell.Row < 3 Then
MsgBox "Select Last Row in Data"
Else
Application.ScreenUpdating = False
Application.DisplayAlerts = False...
I am creating an Archive macro that when pressed will send a worksheet from one workbook to another. Currently the code will open the workbook and send the worksheet and then delete it from the original workbook. The problem I am having is saving the destination workbook after it has been...
I am running a VBA code to convert several excel files and I am needing to get the pop up prompt to stop showing. This is the code I am working with
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:"E\bob_smith\Done.txt" FileFormat:=xlText
Application.DisplayAlerts = True
I...
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim sh As Worksheet
Application.DisplayAlerts = False
For Each sh In ThisWorkbook.Sheets
Select Case sh.Name
Case "Exhibit " & """I"" ", "page 2"
Call...
I am hoping someone can help me simplify this...
I have multiple tabs each I have a separate macro calling for each tab to be written to a directory in a shared network location.
I feel that this could be a lot cleaner...
Also I need it to not run copy the file over if J4 is blank on any of...
With AutoSave ON:
I must close the active workbook after saving as .xlsx
Then, copy the active workbook again,
Delete the unnecessary columns and
SaveAs the .cvs
Otherwise, AutoSave performs the deletion and Autofit on the original copied worksheet.
This code works, but seems kind of...
I am currently attempting to combine multiple sheets from a network location into one sheet.
It looks to process everything okay until the actual output of the final combined worksheet.
I am a little lost as to where it is going wrong.
I did remove the file location of where our server is...
Hello,
Whats wrong with my sumif function?
Sub update2()Dim x As Workbook
Dim y As Workbook
ImportDir1 = Trim(Sheets("Control").Range("H6").Value)
Application.DisplayAlerts = False
Set x = Workbooks.Open(ImportDir1 & "\" & Sheets("Control").Range("C6").Value & ".xlsx")
With x.Sheets(1)...
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.