Reduce Number Of Times Opening And Closing Blank Source File

Jul 9, 2012

I have code in VBA that takes a source Excel file and parses it to multiple re-formatted worksheets. Each formatted worksheet is different depending on a variable in the source. There are n of each type of data (1:n Water Sources, 1:n Water Treatment, 1:n Water Storage). Each item needs a copy of a blank re-formatted worksheet appended to the end of the existing data-type worksheet. For example: Water Source #2 is appended to the bottom of Water Source #1 on the same worksheet.

Currently, I am opening the blank re-formatted workbook each time an additional variable of same type is found in the source file. Meaning, if there are 8 Water Sources, I am opening and closing the blank re-formatted workbook 7 times to copy a blank Water Source to the bottom of the Water Source worksheet and then populate the data. AND if there are 3 Water Treatment, I would open and close the blank formatted workbook 2 more times to copy a blank Water Treatment to the bottom of the Water Treatment worksheet. The same goes for Water Treatment.

Obviously, a huge waste of resources and performance. I would rather open the blank re-formatted workbook once (first time an additional worksheet is needed), use the worksheets as needed, and close it at the end.

Attached is my current, working code of the above.

How should I re-write it to check if the blank workbook is already open use it, if not open it?

Code:
Sub Add_Facility(ByVal Worksheet_Name, Copy_Range, Max_Limit)
Dim Last_Row As Integer
Dim Source_Range As Range
Dim Dest_Range As Range
Dim wkb As Workbook

Set wkb = ActiveWorkbook

[Code] ........

View 5 Replies


ADVERTISEMENT

Closing And Re-opening The Same File In Excel On-click Method

Oct 15, 2008

I was wondering if there is any code using an on-click method. When clicking a button i need excel to exit the file/sheet without saving (no prompts) and then re-open the exact same file/sheet once it has closed.

In a way this is like a refresh button.

View 14 Replies View Related

Reduce Row Range In Existing Worksheet To Reduce File Size

Dec 17, 2013

I have a problem where I extended a formula down to over 40,000 records which has increased the file size substantially. I only need it to scroll down to a few thousand rows now that I realized that there is alot less data to populate the worksheet. Is there any way to get it back to a scroll range that is more modest in size?

View 1 Replies View Related

Stop File Closing If Ranges Blank

Nov 14, 2006

I have workbook that has questions on column K and L that NEED to be answered. When the user closes the spreadsheet I need the macro to create a pop up that says "unfinished Workbook"

So I need a macro that tells the user to finish answering the questions on K and L -

View 5 Replies View Related

Blank Workbook Opening When File Opened

May 31, 2008

When I open a saved excel file I am having a problem with one workbook opening(a blank one), then the box saying that the program contains macros, and then the second actual workbook opening. I do not know what I changed somewhere alone the line, how to make just the one workbook I want (the second one) to open?

View 2 Replies View Related

VBA Code For Opening File With Variable Version Number In File Name?

Jan 29, 2014

I have a file that I save with a new version number each time I make major changes. The file name currently is: "Telephony Equipment Inventory v26 (Summary).xlsm". The "26" is the variable number. give me the vba code to ensure I open the file with the highest version number?

View 6 Replies View Related

Opening Saved File Also Opens Blank Workbook

May 3, 2013

When I open any saved Excel file the saved file opens along with a blank workbook titled "Book 1". How can I make it so when I open any saved Excel file it only opens the file I want and not a new workbook every time?

View 2 Replies View Related

Opening One Book And Closing Another

Jan 14, 2010

Hi everybody, I'm doing my first excel application program and everything is going good,
but I have one problem.

I want to click on a command button in one workbook that is supposed to lead me to a specific sheet in another workbook and to close the first workbook.

I used the following ....

View 9 Replies View Related

Opening And Closing Group Shortcut?

Sep 30, 2011

I know that the shortcut to create a group is Shift + Alt + Right arrow but is there a shorcut to open and close the group?

View 1 Replies View Related

VB Error With Opening/closing Workbook

Jul 6, 2006

I do not understand why my code returns a Run Time Error"9" Subscript out of range. With the following code, I opened a workbook and then wish to close that same workbook without saving. Eventually I will be pulling information from the workbook but for now I just want it to open and then close right away.

Private Sub cb_NewDate_Change()
ListIndex = cb_NewDate.ListIndex

If ListIndex = 0 Then

Application. ScreenUpdating = False

Workbooks.Open Filename:="I:JoeNetwork Conversion FactorsNetworkConversionFactors_Ver_2_0_0.xls"
Application.Workbooks("I:JoeNetwork Conversion FactorsNetworkConversionFactors_Ver_2_0_0.xls").Close False
End Sub

View 3 Replies View Related

Workbook Automatically Opens When Opening/Closing Any Other

Mar 14, 2008

I have a problem, where every time I close or open any workbook, Excel prompts me to "Enable or Disable Macros" in one particular workbook, wether I have tried to open it or not. In the said workbook, I have a macro that automatically updates a pivot table upon selecting the worksheet where the pivot table resides.

The code for it is as follows:

Sub UpdateIt()
Dim iP As Integer
Application.DisplayAlerts = False
For iP = 1 To ActiveSheet.PivotTables.Count
ActiveSheet.PivotTables(iP).RefreshTable
Next
Application.DisplayAlerts = True
End Sub

Private Sub Worksheet_Activate()
Call UpdateIt
End Sub

There is something in the code that calls UpdateIt any time a workbook is opened, closed or selected.

View 3 Replies View Related

Hide Workbook Opening/closing Operation On The Screen

Jul 6, 2007

I am running a script that populates about 70 or so workbooks based on information from the database. Naturally this script is quite slow but what seems to take the most time is opening and closing workbooks. Is there a way to "hide" the workbook opening/closing operation on the screen? I have tried using the

Application. ScreenUpdating = False

this sped the code up but you still see the workbooks opening on the screen.

View 2 Replies View Related

Counting The Number Times A File Is Opened

Oct 14, 2009

I have a workbook setup as Read only for reporting purposes. I would like to capture the number of times and if possible, the users that are opening the file....is there a way?

View 9 Replies View Related

Excel 2010 :: Crash - Ready Calculate Flashing Taskbar When Closing / Opening Userform

Jan 8, 2014

Excel will hang up as if it's gone into a continuous loop (Although no looping macros are active) when you open or close a user form. The task bar in Excel will flash Ready Calculate. Visual basic reports no code is running but excel either crashes or becomes very unresponsive. I have to exit and reopen excel in order to fix the problem . It also doesn't happen at any one specific point it can vary. I have various VLOOKUPs around the workbook and userforms display the correct information. I use the INDEX formula in the control source of textboxes. I also use the offset formula to make sure DTPICKER displays correctly.

I am using 'Option Explicit' at the start of all my code. I have tried a 3rd party code cleaner. No visual Basic references are MISSING

[URL]

View 9 Replies View Related

How To Reduce File Size

Jun 11, 2014

I built a workbook that is used by our account team to summarize account status. Each worksheet has several cells that use conditional formatting to call attention to the status reported in that cell. Each manager sends their worksheets to a Senior manager who then consolidates into a single workbook containing approximately 50 worksheets. Once consolidated, the file size has grown to over 12 Mb and this needs to be reduced to a more manageable number, preferable 4 Mb or less. Prior to buliding the new version of this workbook, the file size was less than 2 Mb.

I have removed the Macros and believe the size is due to the conditional formatting in each worksheet.

Once the worksheets are compiled, is there a way to remove the conditional formatting and save the existing format - Similar to a "Paste Values" function? The senior manager does not need to change cell value to the formatting of the worksheet he receives could be saved.

To be specific - one cell turns has no color if the value is 10 or less, is yellow if 11 - 15, and Red if 16+. Once sent to the manager, the variance in this cell is not needed; he only needs to see the color associated with the value when sent. Next week he will receive an updated worksheet and a new value will be entered. The conditional formatting is only needed by the individual preparing the original worksheet.

View 3 Replies View Related

Reduce File Size :; 50 MB

Mar 31, 2008

I have xls file size 50MB

I want to reduce size kindly give me some tips to reduce size.

View 9 Replies View Related

File Size - Reduce

Feb 13, 2007

I currently have an excel file with lots of formulas on quite a few pages and these are carried down for so many records - its sort of a template to generate information from/to certain sheets for many other purposes.

- is there any way to compress the file (without actually zipping it) as it must remain a working document?

View 7 Replies View Related

Reduce File Size

Apr 28, 2008

My excel file has grown to 23Mb. It has around 10 worksheets and a similar number of userforms. Because the file is large, it slows down the VBA code when it encounters a save command. Is there any way I can improve this? Do userforms use alot of memory or is it the length of code? There are a few images on the userforms but the images are less than 1 Mb in total when all added together.

View 3 Replies View Related

Reduce File Size Considerably?

May 15, 2014

Is there a way to reduce the Excel file size considerably? Any quickest and easiest way to reduce file size in excel ...

View 3 Replies View Related

Reduce File Size By Use Of Macros

Jan 8, 2007

I still cant figure out how to write macros. If someone could help me out with this I would appreciate it.

Currently I have a worksheet that is 20mb.

This file contains what takes up most of the space. I repeat this line many times throughout the worksheet.
010807.zip

Once again it is a zero eliminating code.

If someone could reduce the number of formulas for me, I think I could figure out how to adapt it to repeat throughout the sheet.

View 11 Replies View Related

Reduce File Size :: Without Zip Function

Nov 14, 2003

Is there a way to reduce the Excel file size considerably? This excel file is huge with many sheets. I do not like to use Zip function.

View 9 Replies View Related

Store Formulas In VBA In Order To Reduce File Size

Nov 14, 2011

Have a file of 7 mb having 100 columns and unlimited rows (user defined- approx 500). At all these cells in that area, I refresh (copy/paste) the same formula for all cells, read as:

[=IF($DF47=0,"",IF(ISERROR(MATCH(HE$45,$Q$22:$Q$26,0)),INDEX($DF$12:$HE$31,
MATCH($DF47,$DF$12:$DF$31,0),1+HE$11-$DF$11),INDEX($Q$22:$S$26,
MATCH(HE$45,$Q$22:$Q$26,0),IF($DA47=GROUPSHIP,2,3)))) ].

Refresh is necessary bcs I insert/delete/sort rows.

In order to reduce file size and instead of saving all these formulas into the approx 5000 cells, I would prefer if I could have a function in VBA and call it (with copy/paste) with a smaller formula at all these 5000 cells as: [= myfunction], so as to have this simple formula in each of 5000 cells, hoping that this will reduce size.

How can I write the long formula above to a function in VBA?

View 2 Replies View Related

Reduce File Size Using Macro To Perform 500,000 Calculations

Dec 10, 2008

I have this formula that checks a line of values to see whether it is within the constraints of a separate list of values.

=if(AND(Data1!A4="count1",Data1!D4>="bin1",Data1!D4

View 9 Replies View Related

Reduce The Number Of Lines That Are Highlighted

May 16, 2009

I have the following code in a User form and I was wondering if there was a way to reduce the number of lines that are highlighted, but obviously still get the required results!


Private Sub cbSearch_Click()
Dim Product As Range
Set Product = Sheets("Master").Range("A1:A300").Find(Val(tbLookFor), lookat:=xlWhole, LookIn:=xlValues)
If Product Is Nothing Then
MsgBox "Incorrect Product code, try again"
Else
'Populate the userform with data
tbData1 = Product.Offset(0, 1) 'Down 1 row, over 1 column
tbData2 = Product.Offset(0, 2)
tbData3 = Product.Offset(0, 3)
tbData4 = Product.Offset(0, 4)
tbData5 = Product.Offset(0, 6)
tbData6 = Product.Offset(0, 7)
tbData7 = Product.Offset(0, 8)
tbData8 = Product.Offset(0, 9)
tbData9 = Product.Offset(0, 10)
tbData10 = Product.Offset(0, 11)
tbData11 = Product.Offset(0, 12).....................

View 9 Replies View Related

Workbook Containing Macro To Reduce File Size Locks Up When Shared

May 28, 2008

I've been having trouble recently with my workbook file size growing rapidly due to copy and paste commands and such. I found a very nice macro to reduce file size called ExcelDiet located at [url]
Option Explicit

Sub ExcelDiet()

Dim j As Long
Dim k As Long
Dim LastRow As Long
Dim LastCol As Long
Dim ColFormula As Range
Dim RowFormula As Range
Dim ColValue As Range
Dim RowValue As Range
Dim Shp As Shape
Dim ws As Worksheet

Application. ScreenUpdating = False
Application.DisplayAlerts = False

On Error Resume Next

This code works fine until I share the workbook. Can anyone take a look at this code and provide some information as to why this might be happening?

View 6 Replies View Related

Opening A File Without Opening A Workbook

Apr 17, 2007

I have a need to open a file from my companies intranet. My current method was to open said file via the method that the recorder gave me. However, I would like ot be able to open a said file without having to start open another workbook.

This is the path:
[url]

So the command is this:
Workbooks.Open [url]

Links are not actual links

So what I need to know. Is how can I open this file without opening a workbook. I haven't been able to use the VB "Open Statement" to open a file and I don't believe that I've been successfull using the Filesystem object either.

View 9 Replies View Related

Subtract Dates And Find Time Taken From Opening And Closing Time

Jul 31, 2014

So I have two dates:

Opening Date: 29/07/2014 13:27

Closing Date: 29/07/2014 14:42

These are formatted in DD/MM/YYYY and HH/MM

I need to subtract the dates and find the time taken from the opening and closing time.

View 3 Replies View Related

Reduce Number Of Active Rows In A Worksheet

May 13, 2009

i have data in 1 worksheet say sheet1 which i copy to another sheet say sheet2. i do some processing like using some formulas on the data from columns A to D and getting an output in column E in the same sheet. Now the problem is, before i start the calculations in sheet2, the file size is 400 kB... and after the calculations are done, it becomes 20 mB... i dont know why this happens... there are some things which i think might be a reason but not very sure...

1. i calculate the last row in column A using
lastrow = Range("A65536").End(xlUp).row

i tried Range("A500") and it seemed fine... Now u may tell me that i can just use 500 and make things simpler but its just a workaround and not a solution...

2. i use macros.. this is just an info...

3. Another thing is, if i use 500, the number of active rows is 500... i dont know whether the right word is active rows but wat im trying to say is, the scroll bar for the rows movement reaches row 500 when it reaches the bottom.

View 9 Replies View Related

Closing And Re-opening Form Causes Form To Freeze / Hang

Jun 24, 2013

I have two forms...clicking a specific button on the first form should display the second form which works fine.

VB:
Private Sub Image_Employees_Click()
Form_Main.Hide
Form_Employees.Show

[Code].....

When I do this twice, however, the second form seems to freeze/hang and I have to close Excel and then re-open it. I feel like I'm overlooking something obvious...

View 1 Replies View Related

Leave Planner & Box In Colum A To Reduce The Number Of Days

Mar 18, 2009

I was created an annual leave planner and I would like the box in Colum A to reduce the number of days they have left every time they book leave. I would like it to start off as 25 days leave including UK bank holidays.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved