VBA To Find Cell Below The Last Row And Insert SUM

Apr 15, 2013

I am running a macro which basically is a tidy up of a data report that comes from SQL.

I am on the last bit Every time this tidy up runs there will be a different amount of rows but always the same columns. Under the last row of data I want to put the word 'TOTAL' in that row and column J. Then in the same row but column K I want to put a sum of K2 to that last row. How do I do this?

Here's all my code so far - like I said its basic formatiing stuff I've cobbled together!

Sub usagetidyup()
'
' usagetidyup Macro
'
'
Range("1:4,6:7").Select
Range("A6").Activate
Selection.Delete Shift:=xlUp
Columns("H:H").Select

[Code]...

View 9 Replies


ADVERTISEMENT

Insert Cell Name In FIND Function

Dec 13, 2013

Is it possible to insert a cell refenece into the FIND function.

So, replace JAN-2013 with Sheet1 cell A1

Selection.Find(What:="JAN-2013", After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

View 3 Replies View Related

Find Cell & Insert Rows

Jan 9, 2007

I am trying to find the first "Tour" after cell A138. If "Tour" is not in cell A177, then I want to insert rows until that "Tour" is in cell A177. How can I do this?

Sub InsertRow()
Dim FoundTour As Range
Range("A5").Select
If Range("A30") = "TOUR" Then
Range("A31").Select
Else
Do While Range("A30") <> "TOUR"
Selection.EntireRow.Insert
Loop
End If
Range("A31").Select
If Range("A40") = "TOUR" Then
Range("A41").Select......................

View 6 Replies View Related

Find Cell With Text & Insert Formula Below

Jun 11, 2008

I want the macro to:

1. search A1:AZ1 to find the cell that has the text "VBA Test" in the cell. There could be other text in the cell as well - this is not an exact match - but these two words are the common text.

2. go to that cell

3. go to one cell below that

4. enter a formula (I've got it from here ....)

View 4 Replies View Related

Find Particular Word Then Insert New Entire Column Before Cell

Jan 25, 2014

My worksheet has two sheets which has daily continued data. I want to copy two entire columns E and F from Sheet 1 and then in Sheet 2 I want to find a particular word "80 Percent" and then insert two new Entire columns before that word. And after that I want to paste that copied columns of sheet1 in those newly created columns of sheet 2. Is it really possible because the cell reference of the word "80 Percent" in Sheet 2 will change daily. How to create the macro codes for this.

Find attached file : IRCS1.xlsx‎

View 14 Replies View Related

Macro To Find A Specific Word And Insert Cell

Jan 12, 2010

I have a large spreadsheet with about 18000 rows or data and about 60 columns. I need to a macro to find a specific word in a column like "charge" and anytime that word is found in the column to insert a blank cell in front of it.

Currently the sheet looks like this:Fee AChargeFeeChargeFee AChargeFeeChargeFee AChargeFee AChargeNeed to get it to look like this: (so I can sort and subtotal)Fee AChargeFee AChargeFee AChargeFee ACharge

a macro to the for whichever column I choose.

View 9 Replies View Related

Find Empty Cell In Row After Certain Point Then Insert Values From Another Sheet

Jun 4, 2014

I'm trying to create a macro that when run, scans Row 12 (only after column E), Finds the first empty cell, then inserts the cell value from Sheet4 CellE8. Then the hard bit begins. I need it to insert cell info in all the cells below it, from different locations...

For example

A
B
C
D

[Code].....

In the above sheet, I need it to go to cell D2 and insert the values from Sheet4 CellE8, Then proceed to D3 and insert data from Sheet3 D4, then to cell D5 and insert data from Sheet1 A7, etc etc

I dont mind doing each cell individually, but they will always be in the same column (and row 2 "Value" will always be the one that determines the next empty column).

View 1 Replies View Related

Excel 2010 :: Cell Insert In One Column To Insert In Other Columns?

Mar 23, 2012

I have a master data sheet with four columns, A, B, C and D

Column A has the primary data and B,C,D has dependent data values;

So when I insert a new cell in Column A with cells Shift Down, I want mandatorily new cells to be inserted in the same row in col B, C and D as well so that data integrity is maintained;

View 2 Replies View Related

Find Last Row Containing Value, Then Insert Row After

May 24, 2007

I am creating a worksheet of contacts and the date and time that I phone them, along with their current "status" in our company. I have created a form and have got it to do the insert of new data that I input, BUT What I would really like is enter a "client number" (which is unique) and have it search my table for any record(s) with that client number, and then show me the last record that matches the client number, (this can all be done from within my form) then If I click on the "insert" command button, I want it to insert a new row after the current row and move my form data in the form into the new row which will include a date and time. So, To summarize.....I need 2 similar subroutines.

LOOKUP ----- I need to have my form scan down the data for a match in a particular (pre-sorted) column, stopping at the last line that matches, then display the data or display nothing is there is no match. INSERT ----- I need to have the form scan down the data for a match in a particular (pre-sorted) column, stopping at the last line that matches and then insert a blank row here and move my data into it.

View 4 Replies View Related

Find Different Content And Insert Row Before It

Nov 14, 2013

I`m trying to create a macros that find new cell content in a column and add a row before it.

In the attached file is an example : insert_row.xlsx

In column A is the name of the row. And in some rows the name is changed.

I want to add a row before this change.

View 9 Replies View Related

Find Text And Insert Row

Jun 30, 2009

I need to enter text in a cell, then click on a command button that will run a macro to find that text in a column and if found, insert a row and copy down the formulas from the row above.

View 6 Replies View Related

Sort, Find & Insert Row

Feb 24, 2010

I would like to find a value w/i a column after sorting and insert a row right above it. After that I would like to sort again from that point downward.

View 2 Replies View Related

Find Value & Insert Row Where Found

Nov 3, 2006

I'm having problems with trying to find something in the spreadsheet and inserting a row before it. For example I would like write code that basically goes threw my rows and if it finds the "2800" then it inserts a row before that. I have now bought several books but I have yet to come up with an answer.

View 3 Replies View Related

Insert Value On Clipboard Into Find Method

Jan 31, 2013

How to get the GetFromClipboard syntax from here working with my code (below), but am having a really frustrating time. Basically, I need to search for whatever value is copied to the clipboard (as you can see below which will be relative to a certain cell).

Here's what I have so far, and I'm trying to replace the contents of the What:="121212121" part of the Find method to look for the clipboard contents (a 9 char number) in another sheet (where a duplicate exists - the value I am searching will be a unique identifier for the incorrectly created duplicate record that needs to be deleted).

So, What:=<insert number/string on clipboard here>

VB:
Sub DeleteDupes()

ActiveCell.Offset(0, 5).Range("A1").Select
Selection.Copy
Sheets("ActvMbrs_MatchCombos").Select
Cells.Find(What:="121212121", After:=ActiveCell, LookIn:=xlFormulas, _

[Code] .....

View 2 Replies View Related

Find And Insert Intersecting Values

Oct 6, 2009

I have a spreadsheet named: PartNumVsJobNum

The rows, from row 3 down in column A contain part numbers.

The Columns, in row1, from B to (last column with data) contains job numbers.

On another sheet, named: Non_Completed. I have the part numbers in column A (as in the PartNumVsJobNum worksheet). In column E down are
Job Numbers (IE: 4PZ). In column G are quantity values.

So for instance if Cell (A3) = 360010 (first part number listed)
and Cell (B1) = 4PZ I need a macro the will find the rows with 360010
in Column A on sheets( Non_Completed) and try to find the job number (4PZ)
in (columnE) for one of the rows. If the job number is found, then the value
in G of the (Non_Completed) sheets should be copied to the corresponding XY
cell in the PartNumVsJobNum spreadsheet.

I will need to do this for each job number on PartNumVsJobNum Sheet.

I'm attaching a sample worksheet below.

View 14 Replies View Related

Find Changes In Data And Insert Blank Row

Oct 13, 2009

Need a VBA macro that is similar to the subtotals function but without the subtotals? Basically I want the macro to look at column A and say, for each change in column A insert a blank row… I don’t need to worry about the sorting, I just would like to know how I can tell a spreadsheet to look at a column find changes in that column and just insert a blank row. On the second page of the attached spreadsheet is an example of the desired output… I will probably use this for many different spreadsheets so the simpler and more versatile the better, ie I can change the column I want the macro to look at.

View 3 Replies View Related

Find Macro And Insert Cut Cells?

Dec 21, 2013

I have a worksheet with several thousand rows. During a month new entries are added at the bottom of the previous entries. One of the columns for each entry is a stock symbol and I've written a macro to enable going quickly to any specific stock symbol's location by searching for the symbol.

Once a month I select rows for some of the new entries for a given symbol, cut the relevant rows, activate the macro to find the location of other entries of the same symbol, and then "Insert Cut Cells" so as to move the new rows to the same area as other similar older entries.

What I was finding was that activating the macro was causing a recalculation of the workbook, which delays the macro from finding the symbol in question. This was getting bothersome, so I avoided the delay by adding an Application.Calculation = xlCalculationManual to the beginning of the macro, and at the end of the macro I reset the Calculation back to Automatic.

This eliminates the delay, in finding the old symbol, but it also clears out whatever memory location was storing the cut cells, so that I don't have the "Insert Cut Cells" option available once I get to the found location.

So, currently I have either: A) a quick find of the symbol, but I can't use the "Insert Cut Cells" feature, or B) I have a delay in the finding, but am able to Insert.

how I can have the quick find of the macro but still retain the ability to Insert the cut cells ?

View 8 Replies View Related

Macro To Find Data And Insert Row

Feb 16, 2006

I've got a problem that's causing me a headache. i have a document with 1 column and 4000 rows (its an export from active directory).

I need to do a search cell by cell (so A1 - A4000) for any cells that contain the text "changeType". When a cell is found, i need excel to insert a new row above the current cell and insert the text "modify" into the new row (in the first column).

eg.

x
x
x
changeType
x
x

Becomes:

x
x
x
Modify
ChangeType
x
x

View 7 Replies View Related

Find Value In Column & Copy Insert Row

Feb 11, 2008

I have a macro that was working fine until I added a new column to my active sheet. Now it fails with a run time error 1004, insert method of class failed. The code is as follows:

Private Sub UpdatePart_Click()
Dim S As String
Dim r As Excel. Range
Range("A2").Activate
S = InputBox("Enter the part no. you wish to update")
On Error Resume Next
If S = "" Then 'Exit Sub
'If StrPtr(S) = 0 Then
MsgBox "Update Cancelled"
Else
Set r = Columns(1). Find(What:=S, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)...............

View 8 Replies View Related

Find Last Instance Of A Word And Insert Blank Row

Dec 11, 2008

I would like to be able to add vb code to my developing macro that searches within 1 column for the last instance of a particular word, then inserts a blank row under that word. All the data is sorted, so the words will be used multiple times, but I need the row to go under the last instance of each word in the column.

View 14 Replies View Related

Find Text And Insert 6 Blank Rows Above It

May 15, 2013

I have spreadsheet with data all over. I want a macro which identifies the first cell (in Column A) which has the text "BNY" and insert 6 blank rows above the text "BNY" (First text in the Column).

Once, it is done - the macro should also assign names to the last inserted row.

Column A - Should reflect "Bank", Column B should reflect "Field1", Column C should reflect "Field 2" and Column D should reflect "Field 3".

And after the names are assigned - It should also highlight the last inserted row in Yellow.

For Example:
Raw Data (Snap):
Bank
Field 1
Field 2
Field 3

JPM
123
456
789

[Code] .....

Output (After Macro):
Bank
Field 1
Field 2
Field 3

JPM
123
456
789

[Code] .......

View 5 Replies View Related

Find Replace To Insert Carriage Returns

Jun 30, 2013

I'm working with a document that has several cells which require double carriage returns within cells. The location of each space is marked with an @ sign. A few weeks ago, I found an article online that explained how to do a find replace where the find value was '@' and the replace value was a series of numbers/characters that created a carriage return. When I doubled the carriage return code I got my two spaces. If I remember correctly, the string that I entered still appeared in the cell, so I needed to clean up afterwards by replacing that string with ' ', but it still left the line break.

View 9 Replies View Related

Find Date & Copy Row Insert Formulas Only

Feb 12, 2008

I have a macro that searches a column for a date and then selects the appropriate date. The next step is to then copy the row and insert a new one below the copied one and paste only the formulas and none of the data. I have tried several iterations but all of the seem to paste the data too.

View 6 Replies View Related

Use Excel VBA To Find Values In Table And Insert In To A Comment?

Jul 5, 2012

I have a table refreshed from a MySQL database that I use to create a report. I can use this data quite well using formulas in the cells.But in order for me to add more information to the report I use without making it cluttered I need to add some data as comments.

I have created a loop that picks up some cell values that I want to use as criteria but I cant work out how to use these variables to search through the table and get the info I require to put in the comment. In a cell I would use offset/match or index/match to get the required cell value but how do I do this in VBA?

View 2 Replies View Related

Macro Code To Find / Insert And Fill Text?

Oct 11, 2011

I need a macro script that goes to a particular cell in a column based on a criteria (say, locate the first instance where $0.21 appears in col. H), insert a row above it, and fill the row with the text "Note:These are above $0.20"

View 2 Replies View Related

Adding A Date To One Cell Will Insert Close In Another Cell And Add Color To That Cell?

May 6, 2013

I would like to add a date to one cell (say A6) and have this do two things:

#1) this would add "Closed" to a given cell such a A5.

#2) and this would add a color to a group of cells like A1 through A8.

View 4 Replies View Related

Find Most Recent Date In Column Headings In A Range - Insert New Column And Heading

Apr 4, 2014

I have a 2 groups of column headings with a different month and year in each heading so

1st Group of columns range
Columns AJ through AX
Column Heading example "Expense Ratio February 2013......next Column over is "Expense Ratio March 2013"

2nd Group of columns range AY though CE
Column Heading example "Capital Balance February 2013......next Column over is "Capital Balance March 2013"

Each new month I need to add a new Expense Ratio column after the most recent expense ratio Column. (i.e. Find "Expense Ratio March 2013" and I need to add a column after that with heading "Expense Ratio April 2013"

Same thing for Capital Balance - add a new Capital Balance column after the most recent Capital Balance Column. (i.e. Find "Capital Balance March 2013" and I need to add a column after that for "Expense Ratio April 2013"

Because the ranges keep changing month over month, how do i do this.

View 4 Replies View Related

IF.. Contains...then: Search Through The Text String In That Cell And Find A Certain Word, Find And Retrn A Value

May 23, 2006

I am having trouble getting my IF statement to test if the cell contains the text "sale" return "X" if not "Y". I need it to search through the text string in that cell and find a certain word, and if it finds that word, retrn a value. I am really having difficulty with is what symbol or function do I use for the logical test? (i.e. =, <>, MATCH, INDEX?)

View 4 Replies View Related

Copy / Insert Row In Sheet3 If Cell Value In Sheet2 Matches Cell Value In Sheet1

Sep 17, 2013

I am working a project where I need to copy/insert a Row of data onto Sheet 3 if values from Sheet2 are located on Sheet1. Here is my code so far:

Option Explicit
Sub move_rows()
Dim ws As Worksheet
Dim ws1 As Worksheet

[Code].....

View 3 Replies View Related

Insert Today Date In Specific Cell When Any Cell In Column Changes?

Nov 12, 2013

I would like to know how to use a VBA code to insert today's date into a specific cell (B9) when any cell in column B (B2:B8) has changed.

View 3 Replies View Related







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