# Use A Macro That Creates Sheets And Places Formula In Cells

Jun 20, 2006

I am trying to use a macro that creates sheets and places formulae in cells but the resulting formulae are not what I coded. Here is similar

Function CreateSheet(i As Integer)
Set Adjustment = Worksheets("Sheet1").Cells(6, 3 + 4 * i)
With Selection
.Offset(22, 9).Formula = "=Sheet2!B14*Rating!" & CellAddress
.Offset(23, 9).Formula = "=Sheet2!C14*K4*Rating!" & CellAddress
.Offset(24, 9).Formula = "=Sheet2!D14*K5*Rating!" & CellAddress
End With.............

## Button That Creates New Sheets With Buttons In Those New Sheets?

May 27, 2014

I'm editing some else's workbook. He has a button on sheet 1 that creates sheets 2 ad 3. I can see and edit his old code. I need to add a differet button to these sheets and 3. I can easily do this once those pages are created, but I need those buttons to come up as the sheets are created from the button on sheet 1. T

## Macro: Analyzes Data In 365 Sheets ( Named "1" Through "365") And Creates A Table/report With The Results

Mar 13, 2007

I have a procedure that processes data in a spreadsheet. It analyzes data in 365 sheets ( named "1" through "365") and creates a table/report with the results. When I run this on a scaled down version of my workbook (5 instead of 365 worksheets), the result is almost instantaneous. When this is on my normal workbook, the initial processing is about 1 second per day on Day 1, and the last day it speeds up to almost be instantaneous. It is not a linear relationship between the processing time (still working to get more exact timing information). Also, even if I limit my processing to 5 or 10 sheets, Days 1-10 are always slow and days 350-365 are always fast. The code being run is in the structure as shown below:

numSheets = 365
For counter = 1 To numSheets
x = CalculateSomething(counter)
Next

Private Function calculateSomething(counter As Integer) As Integer

Dim strCounter As String
strCounter = counter

With worksheets(strCounter)
For i = 0 To someNumber
For j = 0 To someDifferentNumber
'Data analyzed on worksheet
Next
Next
End With
End Function

The functions obviously aren't copied and pasted/functional, but the relevant efficiency stuff should be there.

## Number Enter Creates New SHEETS And Auto Assign Names

Jun 29, 2007

B20 is the number that the user enters. It can be any number and it will create new sheets below and text of sheet name in B21:F21.

If i change the sheet name below, B21:F21 would also automatically change.

## Creating A Macro, That Creates A New Button, Which Itself Runs A Macro..

Dec 15, 2009

I have a long complicated macro that processes a ton of data and gives the output in a new sheet. I then want to create new buttons (or some sort of user clickable triggers) on this new sheet that runs another macro.

I have got the actual adding of buttons in the sheet working, but I can't find a way to automatically assign macros to newly generated buttons during runtime. Is this even possible (or are there any clever tricks I could use to get around this?)

## Formula- Creates Random Number

Apr 2, 2007

i have the formula =CHAR(INT(RAND()*25)+65) which creates random number when dragged from say C1 TO C6 however i need the 3rd 4th or 5th character to be a random number between one and 9 is this possible?

## Macro That Creates Many Macros

Jan 17, 2009

I am having a problem trying to create a macro that will loop in order to create several macros. I have a long macro (call it mainmacro) that needs to be able to create several simple macros to be used by the user of the workbook. Each macro has a variable that needs to be taken from mainmacro. Each macro is different based on the value of the 'i' loop variable that the macro is created in. i'm sure im making this sound more complicated than it really is...basically:

Sub mainmacro()

'lots of code not relavent to this issue here

For i = 1 to 10

'create 10 macros that, when run, would highlight A1, A2, etc.
Range("A" & i).Select

Next i
End Sub

This is just an example. But, basically, i just want to be able to automatically create a bunch of macros with a variable from mainmacro.!

## Formula That Creates Unique Number For Repeating List Numbers?

Jun 26, 2013

I need a formula that will add .1, .2, .3, etc. to a repeating list number. See the example below.
Project Work Id

8069000
8069000
8069000
8069000.1

[Code]....

## Changing Text In One Cell Creates Formula Change In Column Below?

Apr 1, 2014

I have a list of pricing and I want to be able to change the text of cell, say "D1", which says "Standard" to say "Premium" and all the formulas would change in accordance. The "Standard" pricing would be, Starting D2, "=C2*.3" and I want them all to go to "Premium" pricing which would be formula "=C2*.35".

What would be the best method of creating this function or formula?

## Create Formula That Creates Average But Excludes Top 10% And Bottom 10% Values?

May 5, 2014

how to create a formula that creates an average but excludes the top 10% and bottom 10% values?

## Add To A Current Macro Which Currently Copies The Master Tab And Creates A New Tab With Tomorrow's Date On It

Jun 1, 2009

I need to add to a current macro which currently copies the master tab and creates a new tab with tomorrow's date on it. For reference here is the current macro:

## Macro To Copy Data From Excel And Creates Pipe Delimited Text File

May 27, 2014

Macro to copy data from Excel sheet and creates a Pipe delimited text file.

## How To Make Same Formula Change In Multiple Places

Jul 7, 2014

I want to change the references in a VLOOKUP formula that is in 20 columns that are not all next to each other. The current formula is:

=VLOOKUP(\$AF5,' COUNTY ROLES '!\$B\$4:\$D\$69,3,0)
and I want the new formula to be
=VLOOKUP(\$AF5,' COUNTY ROLES '!\$B:\$D,3,0).

Is there a way to do this without having to change it in the first cell of each column and then copy/paste it all the way down each column?

## Number Showing Extra Decimal Places In Formula Bar

Aug 22, 2009

If you look at the attached file in Column E line 47 you will see that it displays
373.97. However if you look in the formula bar it shows 373.9694. I am trying to make it so that the formula bar shows the same number as in the cell. Any idea on how to do this? I have tried everything I know how to do, which is not much.

## Format All Percentage Cells To X Decimal Places

May 17, 2008

I would like to do the following: * Format numeric cells (cells with a percent sign) to zero decimal places. I have a set of macros that I am combining to clean up a data set and these are two of many (removing blank lines, duplicates, blue/bold, etc.)

## Concatenate Formula Not Taking Decimal Places/currency Sign

May 26, 2009

i have lets say a table with rows that contain the following data.

SKU - PRICE - SALEPRICE - DESCRIPTION - SALEDESCRIPTION

What I am trying to do, is to make a concat formula that says:

SALEDESCRIPTION = DESCRIPTION+price was+PRICE+now+SALEPRICE

In essence so that i can simply pull down the formula, and all our product descriptions have 'special offer, was xx (price) is now xx (sale price).

This works fine, except that in the SALEDESCRIPTION, the amounts from the price and saleprice fields are being brought over without decimal places and without currency symbol.

I have tried formatting those two columns as currency or accounting but neither works.

## VBA Code - Changing Formatting Of Adjacent Cells At Varying Places

Jul 31, 2012

I have a macro that, at varying places, changes the formatting of adjacent cells. The formatting code is easy to generate via the macro recorder, but it's long - longer than the macro itself - and I'm using it a couple of times (due to if statements). That makes it difficult to read. It's usable, but looks ugly. I'd like to streamline its appearance.

Is there a way to do something like:

Code:
If range("F5").Value > 0 then
Activecell.Offset(1,0) format = blah
ElseIf Range("F5").Value = 0 then
Activecell.Offset(-1,0) format = blah
End If

The formatting I want is dark gray interior with a border box around it. The macro recorder generated this:

Code:
Sub test2()
'
' test2 Macro
'
'
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1

[Code] ............

## Custom Data Validation Formula To Limit Cell Value To Maximum Of 4 Decimal Places

Mar 5, 2009

I require a custom data validation formula to limit cell value to maximum of 4 decimal places.

0.0001 ok
0.02 ok
0.3 ok

0.12345 fail
0.123456 fail etc

## Imported Data Creates Blank Cells That Aren't Really Blank

Feb 21, 2006

Here's what I'm attempting to do: For each column, X,Y, Z, I am attempting
to count nonblanks. However, the data was imported from Access and Oracle,
and Excel treats what appear to be blank cells as nonblanks. I've tested
this theory by highlighting a couple of "blank" cells and deleting them, and
my count changes. So, can I get Excel to put a value into my "blank" cells,
so then I could filter it out, or create a formula that would only count
dates in my columns (which is what I'm after).

This is what I'm looking at:

A B C
1 2/4/2006 2/6/2006 ("blank")
2 ("blank") 12/13/2005 1/7/2006
3 2/20/2006 1/15/2006 ("blank")

In each column if I use a COUNTA I'll get a total of 3, instead of 2 for A,
3 for B and 1 for C.

## Take A Number With Several Decimal Places And Round It Up To Two Decimal Places

Feb 27, 2014

I need a formula to take a number with several decimal places and round it up to two decimal places to either .33, .66 or, .00 if its above .66.

For example, 4.23423423423423 will be 4.33
4.43453453533434 will be 4.66
4.8353453453 will be 5.00

Lets say the number is in cell A1. What formula would do this?

## Formula For Connecting Multiple Sheets And Cells?

Sep 25, 2011

I am using a spreadsheet for a weekly football league. I would like "Sheet 1" to have the picks for the current week with the point total at the bottom for each team (I have that set up), but on a different "Sheet" I would like to keep a running total for each team. I know how to creat a formula for the total points, but how do I get that formula to attach to the corresponding column on the same row.

EX:
A B
"Team Name" "Formula for total points"

I would like A and B to stay connected when I auto arrange them in numerical order.

## Prevent Formula From Updating When Deleting Cells / Sheets

Nov 5, 2008

I've got a workbook that I'm currently designing and I've just realised that I need to delete a few sheets, paste in some new template sheets and rename them. The problem is, I've already completed my summary sheets and I don't want to have to redo the values. Essentially, I just want to (temporarily) turn off auto-updating of formulas when cells / sheets are changed/moved/deleted.

For practical purposes: I need to delete the sheet named "Jan", paste in a new sheet "MonthTemp", rename "MonthTemp" to "Jan" and have all my formulas not updated (e.g. still referencing "Jan" instead of "#REF!")

## Macro Add Sheets Using Template And Name Them From Column Of Cells

Feb 4, 2014

Step 1: I have data coming from a data dump which is placed on the "Summary" sheet of my excel workbook. I need to take column A (beginning at A8) and create a new sheet (based on "Template" located in the same workbook) for each name in column A.

Step 2: I need to place the name of the new sheets in cell C4 of each sheet so I can do a lookup using C4 as my lookup_value, so this can't be a formula like "=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)" because lookup doesn't function properly.

Step 3: Delete "Template", so that the only things left are the "Summary" sheet and the new sheets.

Each department will have their own workbook with a "summary" sheet and different sheet names although they will all start off with the same data dump and will all be in the same format. Each department could also have a different number of new sheets added depending on information from the data dump.

I found a utility (ASAP Utilities) which will do the steps I need done, but it won't record in the macro.

Budget time is fast approaching and each department needs their worksheets.

## Fill Alternate Cells Macro, All Sheets

Dec 22, 2005

Would like a script that will go to each sheet in the workbook, and fill in light grey background, each alternate row that contains data, EXCLUDING the 1st row (header row).

## Macro Is Selecting Blank Cells When Merging Sheets?

Feb 19, 2014

I have some reports that I run that go out to analyst daily and I use this script to merge all the documents together. They are the same everytime. However it includes a series of blank rows because the vba I use to create them I believe causes this. Is there a command to remove the VBA when merging them together. Here is the selection copy piece.

HTML Code:
'Import a sheet from found files
Do While Len(fName) > 0
If fName ThisWorkbook.Name Then

[Code].....

## Macro For Getting Colored Cells In Separate Sheets In To One Consolidated Sheet?

Dec 2, 2013

Macro for getting colored cells in specific range in a separate sheets in to one consolidated sheet.

Have attached an excel as a reference.. marked yellow and red.

## Macro Challenge-Copy Range Of Non Empty Cells From 2 Sheets

Mar 20, 2007

first time posting. Need some help. I have a workbook with two sheets - (say sheet A and sheet B) that I need to copy a range from and paste (concatonated) into a new workbook. The thing is I want to copy the "non-empty" cells in columns d and e of each sheet - another words - I dont want to specify a specific cell range because users will be periodically adding new rows. Then I want to paste the "combined" from both sheets into a new sheet in a new workbook.

## Loop Through Sheets And Convert Specific Formula Cells To Values Based On Criteria?

Jan 9, 2011

I looking for a macro that will go through multiple sheets & change specific cells to values if the column header is = to value set in specific cell.

for example

I would like the macro to look at row 3 in each tab (page 1, page 2, page 3) and if the value you is equal to X (parameter input on different sheet) then change the formula to a value in row 6 & row 12 of that column.

I'm attaching an simple example that i looking for this on. The green cells are the one i would like to change to a value.

Book1.xlsx

## Adding New Sub Call Creates

Jan 28, 2009

I added a new sub to and now I'm getting a compile error. This was working fine until I added "Cust_Rev1". I get an compile error saying "expected variable or procedure, not module". Both are located in personal.xlsb. If I rem Cust_Rev1 out, I don't get a hiccup. (FWIW, I've been running "Cust_Rev1" on its own to debug it.)

## Udf That Creates Cell Comments

Feb 15, 2007

I have a list on my first worksheet that is sequentially numbered in the first column, and has work activities in the next column. On my second worksheet, I have those sequential activity numbers as the column headers on a new list. Problem is I don't have any room to label the new list by the activity's actual description(second column, first sheet). If I did, I would just use a simple VLOOKUP.

So, what I would like to do is utilize the VLOOKUP to pass the activity description string to a UDF that will create a comment in those column headers. Then when the user mouses over the activity numbers, the respective activity descripiton will pop-up as a comment thus solving my space problem!