Applying Macro To Entire Spreadsheet At Once

Feb 6, 2009

For simplicity, let's assume I have three columns, "Company," "Policy," and "Balance."

Example:
Company A Life $1
Company A Med $2
Company A Dent $3
Company A Disab $4
Company B Life $9
Company B Med $5
Company B Dent $7
Company B Disab $2

According to my post preview, the columns are running together, but I do have it arranged in three distinct columns. What I want to do is program a macro to do the following:

Every time the name of the company changes, I want Excel to insert two rows after the last of the group, and have a summation of the "Balance" column in the first inserted row.

This is what it should look like:

Company A Life $1
Company A Med $2
Company A Dent $3
Company A Disab $4
$10 <- (this should be directly under the $4, but I'm not good with forum languages)

Company B Life $9
Company B Med $5
Company B Dent $7
Company B Disab $2
$23 <- (same with this - should be directly under the $4)

View 3 Replies


ADVERTISEMENT

Applying Formula To Entire Column Without Lengthening Spreadsheet?

Jul 29, 2014

I'm wondering if it's possible to have a formula applied to an entire column without adding unnecessary length to the spreadsheet until someone is actually scrolling down and using more rows. I want formulas to be constantly present in two columns to automatically calculate values as they are entered into other cells in the same row, but ideally without the otherwise empty spreadsheet being X amount of rows long.

I initially had the formula dragged down 15,000 rows, but it would really be much better if it could start out as a smaller size and then expand as the user requires.

View 9 Replies View Related

Applying Same Formula To Entire Row

Feb 20, 2012

I have an excel sheet where I do a simple price-discount calculation for a product. Please check the file at:

Code: [URL] ........

A2 shows the price, B2 shows the discount and C1-L1 shows the number of units sold. C2-L2 is where I want to calculate the earnings based on the formula I have in C2. I want to apply the same formula to the entire row so that I can quickly see the earning for any number of units sold.

View 3 Replies View Related

Applying Formulas To An Entire Column Of Cells

Mar 20, 2007

how do I apply a formula I entered into one cell to all the cells in that column, without going through the tedious process of typing the formula in again in each cell ? I've done it before but don't remember how.

View 2 Replies View Related

Autofill Entire Row With Data From Above Over Entire Spreadsheet

Jul 28, 2014

I'm trying to autofill a series of rows (that are blank) with data from an above row. I want to autofill the row in its entirety, not just filling in blank cells.

For instance (assuming comma is a new column). Colors listed are just a data example. Space between commas indicates a blank cell:

142, RED, GREEN, , YELLOW, , BLACK, PURPLE
(blank row)
142, GREEN, RED, ,BLACK, , PINK, ,
(blank row)
(blank row)
(blank row)
154, YELLOW, BLACK, , GRAY, , PURPLE, RED
(blank row)
(blank row)

So rather than it just completing the task in one desired cell, it would complete the task over the entire spreadsheet. Data spread can be as far as row 500 and column BY, so you can see how a copy + paste or a drag would get monotonous.

Another small example data set:

1,1,1453,0,10,-35
(blank row)
(blank row)
0,0,1448,0, ,-35
(blank row)
1, ,1443,1,3,-36
1,2,1408,2,7, ,
(blank row)
(blank row)
(blank row)
1,2, ,2,7,-39
(blank row)
(blank row)
1,3,1344,1,10,31

And column A will always have data (unless the row is completely blank.

View 1 Replies View Related

Alphabetizing Entire Spreadsheet

Sep 2, 2009

I'm trying to sort a spreadsheet that has 6 columns with 36 rows total. I want to alphabetize the entire spreadsheet, from A1 to F36 so that A1 is the first of the alphabet and F36 is the last. When I select all the data on the spreadsheet and click sort by ascending, it sorts the columns within themselves instead of within each other.

View 5 Replies View Related

Keep Entire Rows Of Spreadsheet Together

Jan 4, 2013

I've got spreadsheet I use to control the inventory of my user equipment; who has it, what is it, where is it, etc.

I'd like to "lock" multiple consecutive cells of each row so that they never seperate. This is because they need to be together. However, periodically, I need to move, sort, or rearrange the sheet.

Is there a way I can "idiot proof" this so that these cells never come unlocked from each other?

There is no vba involved (primarily because I don't know how), and no other scripting either.

View 2 Replies View Related

Use Combobox To Replace Variable Across Entire Spreadsheet

Oct 21, 2012

I have a dropdown box containing text strings. How can I use the selection from a combo box as part of a formula?

So for example I have a spreadsheet that is set up using a search term 'media', I want to select something else from the list e.g 'arts' and I want all of the references to 'media' to turn into 'arts' in the formulas. Kind of like a mass find and replace.

View 1 Replies View Related

Insert A Button In Spreadsheet - Check The Entire Column?

Jul 13, 2012

I insert a button in spreadsheet, when I click this button a userform appears with place to input value. I would like to check the entire column (maybe < 100 rows), if there is number exceed the input, then disply that ROW in another sheet.

View 1 Replies View Related

Find A Value In Cell Then Copy Entire Row And Paste At Top Of Same Spreadsheet

Jan 8, 2014

first need to look for "PR" in column G, if found need to cut the entire row and insert at the top of the same worksheet.

View 1 Replies View Related

Applying Macro To Selected Range

Apr 3, 2014

I have a macro which sorts data within a cell. This is working perfectly fine but the only problem with this is that it works only for a single which is selected. How can I apply this macro to range of cells I select using a mouse.

View 3 Replies View Related

Applying Macro Code In Multiple Sheets?

May 23, 2013

i have a macro code but i don't know how to apply it to all sheets in the same workbook

my code is

VB:
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Range("D5:D100"), Target) Is Nothing Then
Target.Offset(0, 1).Value = Now() [code]....

View 1 Replies View Related

Applying Macro Code To A Range Of Cells

Dec 26, 2009

how can i do the following using VBA
making each cell in column A added to each cell in column B and the result will be in the column C
for example
c1=A1+B1
c2=A2+B2
c3=A3+B3
... etc

i know i can do that simply without vba code but I just want to use this method to implement more complex formulas .

View 9 Replies View Related

Cannot Select And Pull Down Cells To Copy After Applying A Macro

Apr 23, 2014

I was messing around with some Macros, as an issue came up where clients were pasting over Data Validated cells (thus removing the validation). Somehow though, the feature where you can select a cell, then pull the active cell down through the column (and then can copy, fill series, etc)has become disabled. I deleted all the macros, and turned them off in the Trust Center, but when I click on a cell the box and plus sign still won't display for me to pull the cell down the column.

View 2 Replies View Related

Excel 2010 :: Macro For Applying Changes To Multiple Files

Aug 16, 2012

Excel 2010, Windows 7

I have a whole ton of *.dbf files (98 to be exact), that are from ArcGIS shapefiles. These date1_date2.dbf files have point names, and values, as shown below.

NAMERASTERVALU
Point 1-9999.00000000
Point 2-9999.00000000
Point 3-9999.00000000
Point 4-4.93072701
Point 5-8.90071201

I'm trying to figure out how to transpose each of the dbf files and save them as a text file (tab deliminated). My original plan involved saving them all as text files, then using a convoluted Unix script (I'm what you call a "dirty programmer") to transpose them and then combine them all into a single file. Since there are so many files (and I plan to do this in the future as well), I thought if I could at least automate the text file creation, I'd be ahead of the game. Even better would be a macro that will transpose the data for EACH file, then create a 99 (98 files + header row) row, 5 column text file. Creating the text files (1 text file for each dbf file) automatically .

All the *.dbf files will have exactly the same # rows/columns (2 columns, 6 rows)

This is what I've tried so far.
1)open one of the dbf files in Excel
2)record my marco (using the Personal Macro Workbook option - so it will be available in any workbook)
2a) transpose data (and paste it right below the original data so that the new data is in rows 7 and 8 of the same file)
2b) save as text file (tab deliminated)
2c) stop recording, and end up with this:

NAMERASTERVALU
Point 1-9999.00000000
Point 2-9999.00000000
Point 3-9999.00000000
Point 4-4.93072701
Point 5-8.90071201
NAMEPoint 1Point 2Point 3Point 4Point 5
RASTERVALU-9999.00000000-9999.00000000-9999.00000000-4.93072701-8.90071201

So now I want to apply the macro I just created to all open workbooks (after I bring in all the bdf files), but the macro isn't listed when I click the "view macros" button. All I want to do is apply the steps I recorded in the macro to all open workbooks.

View 6 Replies View Related

Catch An Error And Reset The Entire Code To The Very Beginning And Skip That Entire Entry

Jun 5, 2008

I want to catch an error and reset the entire code to the very beginning and skip that entire entry. When I use "Next fieldSheetName" I get "Next without For," error 1004. Searches tell me I have an open block somewhere, but that's not true. Removing that statement (and having the loop iterate as normal) has no error at all.

Dim employeeName As String
Dim fieldMax, x, y As Byte ' Counters mostly
Dim workedHours, fieldSheetName As Integer

fieldMax = 204 ' Row number to stop on in the field time sheet
row = 4 ' Row specification for field time sheet. Begin at row 4 to ignore headers
' and start on the first name. This should not be changed!
Col = 3 ' Start at column 3 then increase by one to start going to next time entry

' RESET HERE!
For fieldSheetName = 4 To fieldMax Step 8 ' This is our MAIN loop. It iterates from 0 to fieldMax, which is 204...........

View 9 Replies View Related

Macro That Will Shade Entire Row Red

Jun 4, 2014

I have a spreadsheet with columns a-v. Column F (titled aging) displays how many days old an issue is. I would like to have a macro that will automatically shade a row light red if the number is less than 90. I don't want the entire row shaded, just the contents of column a-v.

View 2 Replies View Related

Macro For Entire Column

Nov 12, 2013

I have created one excel which contains column with range. (A1:A6). and the drop box included the values as Passed, failed, NA, NC) i have coded the the macro to change color as if i select passed from A1 then A1: F1 will be Red. please find the below code.

Sub Prasanna1()
Range("A1").Select
Select Case Range("A1").Value
Case "Prasanna"
Range("A1:F1").Interior.ColorIndex = 7
Case "Kale"
Range("A1:F1").Interior.ColorIndex = 0

[Code]...

The code is working fine for one row. Now i want to set the same code for entire column A. as if i will select A10 the same range of row should get change with fill color.

View 3 Replies View Related

Macro - How To Delete Entire Row

Mar 17, 2014

If column B contains the word FALSE, I need to delete that entire row, then I need to repeat this action on 11 sheets out of 14 on one workbook, in one action.

View 6 Replies View Related

Highlight An Entire Row And Then Run A Macro

May 16, 2009

Here's what i am trying to do... I have a workbook with lots of info, i believe there is a way to highlight an entire row and then run a macro that will then collect the info from certain columns (along the specific highlighted row) say, columns A-F and M & P for one example, the collected data will then be copied to a new pre-designed template, and pasted into set cells. The cells that the data will be pasted into will not be along one row though, the pre-defined template will resemble say, an application form Can this be done, I understand macros only at a basic level currently but am trying to understand the VBA way of creating them too now.

View 9 Replies View Related

IF Function Not Working For Entire Row While On Macro

May 10, 2014

I got a problem with a macro i'm working on. I got column D which contains text as "Figures", "Toys", "3DS", "PS3" etc. I also got column N where i need the macro to display "Toys" if it's a toy, figure, etc; or "Games" if it's "PS3", "PS4" etc.

I'm using the following code, to also select only blank rows (so to ignore row 1 which is table header). Problem is that the result shows only "Games".

VB:
Columns("N:N").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=IF(RC[-9]=""*toys*"",""Toys"",""Games"")"

View 4 Replies View Related

Macro To Cut And Paste Entire Column?

Jun 2, 2014

I recored a macro to Cut the entire "E" column and paste on "A". For some reason when i read the code it doesnt capture the part where it needs to paste it in column "A".

View 1 Replies View Related

Keep Macro From Clear Entire Sheet

Feb 25, 2014

This macro clears all the contents of each sheet to which it refers, however, after putting it to use I find that I need it to clear only columns A-G starting at row 10. I am not sure how to modify it to do so though. Actually it would be even better if it would only clear columns A, B, C, E, F, and G.

View 14 Replies View Related

Macro Is Deleting My Entire Sheet

Nov 15, 2006

Sub Delete()
Dim x As Long
For x = 28 To 8 Step -1
If Range("b" & x) = "" Then _
Range("b" & x).EntireRow.Delete
Next x
End Sub

View 9 Replies View Related

VBA Macro To Copy Entire Row To Another Sheet

Feb 20, 2010

I have written Macro to copy every row in "sheet1" 24 times into new sheet called "NewSheet". but it keep giving me error message. Actually, I don't know why. Can any one please help.

here is my macro

Sub CopyRowsBook2()

Worksheets.Add().Name = "NewSheet"
Sheets("Sheet1").Select
' Find the last row of data
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row

' Loop through each row
For x = 2 To FinalRow
Worksheets("sheet1").Cells(x, 1).Select
ActiveCell.EntireRow.Select
Selection.Copy
' Loop to copy every row 24 times
For i = 1 To 24

Sheets("NewSheet").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.Paste

Next i

Sheets("Sheet1").Select


Next x
End Sub

View 9 Replies View Related

Macro To Move Entire Column

Aug 14, 2007

I have Excel 2002. I need to create a formula that will move an entire row to another page within the same workbook if a cell in that row has a certain value. Example would be if A1 cell in the row has a value of 111 I need to move the entire row to another page. I could use the sort then cut function in a macro but the spread sheet I'm working with changes daily. One day there will be 10 A1 cells with 111 the next 30 cells with 111 in A1 and some days no cells with 111.

View 4 Replies View Related

Macro To Copy Entire Row From A Selected Cell

Nov 10, 2008

I have a macro that will go through a set of numbers and check them against a condition. if the cell complies with the condition i want to copy the entire row to a new sheet. sofar I have tried the following to select the current row but to no avail.

View 4 Replies View Related

Macro To Change Font Of Entire Workbook

Oct 12, 2010

I have an existing macro that takes my sheet and puts it in body of email.

how do i add to it to change the entire worksheet's font?

Code:
Function RangetoHTML(rng As Range)
Dim fso As Object
Dim ts As Object
Dim sTempFile As String
Dim objWB As Workbook
Dim i As Long
Dim iLastRow As Long
sTempFile = Environ$("temp") & "/" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"

[code]....

View 4 Replies View Related

Macro That Will Delete Duplicates On Entire Worksheets

Dec 29, 2011

I have a macro that delete empty cells in a column, what i wanted to do is while deleting the empty cells is that the macro will also delete duplicates in ENTIRE WORKSHEETS. My file has so many sheets so i need a macro that run or loop on my entire worksheets.

This is my code. that only runs in a single sheet.

Code:

Sub deleteblanks()
Columns("H").SpecialCells(xlBlanks).Delete (xlUp)
End Sub

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

View 9 Replies View Related

Delete Entire Row Through Macro Button And VB Code

Aug 21, 2007

How can we delete entire row using VB Code.

say example i want to delete a row having name 'Anis' by clicking on a buttton

is this possible?

View 9 Replies View Related







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