Inserting Multiple Cells And Shifting Down Column Multiple Rows In IF Statement

Sep 7, 2012

how to shift data in a column down multiple rows while in an IF statement. I am assuming you cannot just simply repeat the insert cell formula.

Here is my code - it's ugly but it was working when I just needed it to move down one cell:

lastrow = Range("A2").End(xlDown).Row
For i = 2 To lastrow
Range("B" & i).Select
If Range("B" & i).Value = Range("B" & i).Offset(-1, 1).Value Then

[Code].....

View 1 Replies


ADVERTISEMENT

Excel 2010 :: VBA Code For Inserting Text In All Column B-cells Of Multiple Selected Rows

Jul 11, 2012

Software: Excel 2010, Windows 7

What is the VBA code for inserting text in all column B-cells of multiple selected rows?

I am creating a worksheet with a table containing various data related to orders of various materials (this is more or less data gathering from an older, paper-based 'system'). This table spans, columnwise, from A to D and expands downwards as more orders are added. The information in each column is: A=order number, B=type of material and C=material specs. and D=additional comments.

I've set it up so that the only thing I really have to do is to insert the type of material in the cells of column B, and the rest will sort itself out. Instead of having to insert a new row for each new entry and manually typing in the name of the material (these entries are often done in the midst of already existing data), I created several similar, macroed buttons for the different types of materials we use. These macros work by selecting the row of the currently active cell, inserting a new row and then add the name of the material in the column B-cell of this new row. What I am having trouble doing though, is to get the text-entry to work for a selection of multiple cells.

As an example, lets say that I would like to add 5 orders of "Grade A Steel" in the middle of the table - in the row above row 8. With the macro I currently have I can select cell B5, click the macro, and a new row will be inserted with "Grade A Steel" in column B of this new row. This action could be performed 5 times over, but would be easier if I could just mark a range of 5 cells, say B8:B12, click the macro and get the text/data inserted the column B-cells of all 5 of the new rows. So far I've been able to create a macro that inserts multiple new rows, but I've only been successful in filling the column B-cell in the first row leaving the 4 below empty.

View 8 Replies View Related

Comparing Values In One Column And Inserting Multiple Blank Rows

Oct 13, 2006

I am working on formatting a spreadsheet report where the values will change in column A. Here is what I would like to do via a Macro. Compare the cells in column A (e.g., compare A2 to A3, compare A3 to A4, and so on). If the values between the two cells in column A are different, insert three blank rows and set the active cell to the next cell following the blank lines. Example:

if cell A5 is different from A6, insert three blank rows below row 5 and new active cell is now A9 and the comparison would start again. I have been trying to code the macro for this but with no success. Here is the macro I have been working on.

Sub Macro1()
Const NumRow As Integer = 3
Dim StartCell As Range
Dim RowNR, NewCnt As Long
Dim RowCount As Long
Dim Count As Long
Dim intRow As Integer
Dim bFmtComplete As Boolean
RowCount = Application.WorksheetFunction.CountA _
(Range("A1", Range("A" & Rows.Count).End(xlUp)))
bFmtComplete = False
RowNR = 2
Range("A1:J1").Select
' Rows("1:1").Select
Selection.Copy................

View 4 Replies View Related

Inserting Multiple Rows

Nov 2, 2010

I am new to VBA and am trying to insert 20 blank rows to my spreadsheet. I know how to add one row, but am not sure how to add 20 rows without repeating the same line of code 20 times.

View 6 Replies View Related

Inserting Rows On Multiple Pages

Mar 21, 2006

I am working on a database with Names and Volunteer Hours worked over about five years.

What I have is one sheet with names and info, and the respective sheets for each year and different events they worked that year.

on each year sheet I have only the first and last name, which is all that I need for personal info. I have these names on the seet using the sheet1!A1 formula. However whenever I add someone new they will not update the new row on the other sheets, they will simply ignore it. How can I make it respect my row updates?

View 3 Replies View Related

Macro - Inserting Multiple Rows

Feb 23, 2009

see the attachment. You will see that I have recorded two macros:

1) To insert a new row for new people.
2) To insert a row for new animals.

With regards to 1), I would like to create a macro that copies the contents of the row with the penultimate name in the people section, and for a new row to be inserted beneath the copied cell. Similarly, with regards to 2) I would like to create a macro that copies the contents of the row with the penultimate name in the animal section, and for a new row to be inserted beneath the copied cell.

The issue that I have is that the macros do not copy the penultimate cell in each section, but copy a particular row, say row 11 each time I want to insert a new animal. So if I had inserted numerous new rows for the people section, and subsequently wanted to insert a new row for the animal section, I press “crtl+sht+a” which copies the contents of row 11 and which is not the contents of the penultimate row for the animal section.

View 2 Replies View Related

Inserting Multiple Table Rows At Once With VBA?

Apr 4, 2014

way to insert multiple table rows (not entire rows) at once without having to make a loop? Let's say I want to insert 3 blank rows into my table at row 5. The way to accomplish this with a loop would be:

Code:
For x = 1 To 3
ActiveSheet.ListObjects("Table1").ListRows.Add (5)
Next x

Was wondering if there is a more simple way to do this (maybe even a one liner?)

View 1 Replies View Related

Inserting $ Symbol Into Multiple Cells?

Mar 20, 2014

My current issue is that I need to enter a $ into multiple formulas before cell numbers without having to do it manually, is there a way to do this? I cannot drag the cell across with the $ already entered as this will change the cell reference in an adjacent cell.

If this is not clear, what my scenario is that I have a 250 x 2500 cell table. Going across the x axis the formula is: J2-AVERAGE(J$2:J$11) then the next cell K2-AVERAGE(K$2:K$11) and so on. I now want a $ to appear before J and K without having to manually insert $ into every formula, so that I can drag the columns down varying the column number.

View 5 Replies View Related

Delete Rows Where Multiple Column Meets Multiple Criteria

Sep 29, 2011

Need to create a macro?

Delete rows where multiple column meets multiple criteria.

detail:
delete rows where
Column H is less than 10000
AND
Column C is empty(blank)

Those 2 criteria have to occur at the same time..

View 1 Replies View Related

Deleting Duplicate Row (8 Cells) And Shifting Unique Rows Up - 3 Columns As Filter

Feb 4, 2014

I am looking for some code that will use A,B,C as filters to find duplicate cells, and if duplicate found, there should be deleted the duplicated row (but not only the row from a,b,c column, but the whole 8 cells from that row - A,B,C,D,E,F,G,H).

As filter I would like to be used A,B,C columns.

EXAMPLE:
BEFORE
A B C D E F G H
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar1 1
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar01 1
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar001 1
Bojan Smileski 5,2,1992 1356 Prilep Prilep Borka Taleski 1

AFTER
A B C D E F G H
Kristijan Markovski 26,2,1992 1389 Prilep Prilep Mice Kozar1 1

Bojan Smileski 5,2,1992 1356 Prilep Prilep Borka Taleski 1

View 1 Replies View Related

VBA Excel To Transpose Multiple Rows And Multiple Column?

Jul 3, 2013

I was planning to transpose this sample data into the output designated below.

Original sample: (There is an empty row after every 4 entries)

Name: xxx
Email: xxx
Phone Number: xxx
Address: xxx

[Code].....

View 9 Replies View Related

Concatenate Multiple Cells And Inserting Space With Comma In Between Each Name

May 23, 2014

I have several lists of hundreds of emails that I need to list in an email string via Lotus Notes. I need a space and comma in between each name, ex:

john.doe@dm.com, john.doe1@dm.com, john.doe2@dm.com

I am using the below formula manually but it is taking too long. How to automate this? Is there a way to create the space and comma for as long as the list is?

=CONCATENATE(B6,", ",B7,", ",B8,", ",B9,", ",B10,", ",B12,", ",B13,", ",B14,", ",B15,", ",B16,", ",B17)

View 2 Replies View Related

SUMIF Statement With Multiple Criteria In Same Column

Jan 26, 2004

I'm trying to create a SUMIF statement that that has an embedded OR statement within, and am unable to make it work.

Basically I want to say if "column Q" equals one of 2 criteria ("cat" or "dog") then sum the corresponding number in "column P" I've tried the following statement, but it is just resulting in a zero:

=SUMIF(Q9:Q32792,OR("cat","dog"),P9:P32792)

I've seen support on statements with multiple criteria in DIFFERENT columns, but not if searching for multiple criteria in the SAME column.

View 5 Replies View Related

IF Statement To Evaluate Multiple Cells

Jun 9, 2014

I have a ss that has item descriptions, quantities and pricing.

Item descriptions are identified by a letter (a, b, c, etc) and in cells C20:c32. These are selected by drop down box. Item quantities are in cells E20:E32.

I want to evaluate cells C20:C32 and determine what letter is chosen. If A is selected in any cell C20:c32 I want to count the quantities for A in cells E20:E32. I can't quite figure out how to do this.

View 2 Replies View Related

IF Statement On Multiple Cells Not In Range

Jan 8, 2014

I'm after a formula that will look at a number of cells(that are not in a range) with the word "C" and if they all = "C" then I want the cell to come back with the result "yes" otherwise "no".

View 12 Replies View Related

IF Statement Help With Values In Multiple Cells

Jul 24, 2009

I need to see if it is possible to set up an IF statement that can pull information from cells based on the results already available in those cells.

ABCDEFGHIJKLM1Non FeaturedGoodGoodIdentical IMEIsGoodNeeds RLM NumGoodGoodGoodChk DOA BoxGood32Non FeaturedNo ExchangeGoodGoodGoodNeeds RLM NumGoodGoodGoodChk DOA BoxGood23

What I need is a formula in cell M1 that will check each cell B1 thru K1 for the data "Good". If it does not equal "Good", then I need the checks true/false value(s) to show the reason shown in the other cells.

In other words, for row 1, i need a formula where the outcome would be "Identical IMEIs" because D1 is the first box in the set that does not equal "Good". Then if D1 was corrected to "Good", the outcome would then be "Needs RLM Num".

I tried to do it in sections such as {=IF(B7"Good",B7, then the next check )} but the number of statements exceeds the number of IF statements that can be nested. And I really need the formula to fit in one cell.

View 9 Replies View Related

If Statement Covering Multiple Non Adjacent Cells

Aug 1, 2006

I want a message to show up if I have any of 6 selected cells empty? It basically serves as a reminder to fill in all required cells in a sheet that may be located in different cells. How can I write a formula in one cell that will look at all source cells and tel me that some are empty?

NameAgeLocation
Joe******

HeightWeightTime
******3 PM

Formula Here to verify all filled in.

View 2 Replies View Related

Inserting A Block Of Cells Using An If Statement

Jun 26, 2008

task of inserting a block of cells into a worksheet.

I have saved 4 different blocks of cells and depending on an option chosen from a drop down menu i want to select one of more of these sets of data and paste them into a worksheet.

View 10 Replies View Related

Create Multiple IF Statement And Multiple VLOOKUP Within Same Formula

Aug 11, 2014

I am trying to create a formula which looks in 1 cell to determine 'IF' it states either "BUTT CUT" or "DIE CUT" and then does a VLOOKUP in a table array for each which ever column relates to asnwer to 'IF statement.

This is as far as I have got but even this won't work:

=IF(I15="BUTT CUT",=VLOOKUP(J15,V13:Z22,2,FALSE))

View 7 Replies View Related

IF Statement Using Multiple Variables To Give Multiple Outcomes

Feb 6, 2009

I'm looking to work out an IF statement based on a series of dates entered to give 1 of 3 possable outcomes. Where:

A1: todays date (exmaple =NOW())
B1: due date (exmaple 10/02/09)
C1: completion date (example 12/02/09)
D1: status (overdue, outstanding or completed)

D1: =IF(A1>B1,"overdue",IF(A1<B1,"outstanding",IF(C1<=>A1 & B1,"completed")))

I know the last part is totally wrong (symbols arranged in that manner), but to clarify i would like the date entered in C1 to override the other statements in the fomula to make it read "completed". If no date is entered in C1 then the formula will return either "overdue" or "outstanding" depending on the other dates in A1 and B1.

View 2 Replies View Related

Combining Multiple Cells In Multiple Worksheets In Multiple Workbooks Into One Table

Jan 6, 2009

I'm currently doing a survey using an excel workbook that contains multiple questions across multiple worksheets using radio buttons linked to certain cells.

I have around 400 workbooks coming back to me, so what i want to do is take specific values from across many worksheets within each workbook and combine them into a large master table in a seperate workbook.

I've tried using VBA, but not being very proficient at it i've hit a brick wall with that, so i'm hoping that there is an easier way to do it than what i'm currently pursuing.

View 9 Replies View Related

Multiple Ccolums/rows To Get Data From Multiple Columns/rows (vlookup)

Jan 15, 2010

I have created a spreadsheet to show some reports and I wanted to serch for some datas which overloops themeselves. If you can have a look at a test file I attached you will see the full picture. I have 2 tables, where the 2nd one is on the right side of the 1st one. 1st table:..............

View 3 Replies View Related

Eliminate Blank Rows By Shifting Rows Up

Nov 4, 2008

I have the code below that clears colums B-J and L-N in whatever row you activate a cell in. When a row gets cleared, how do I shift all the other rows up to eliminate blank rows in between the data real-time? I've deactivated the cut function already since this messes up references in the worksheet, so it would have to only use copy, paste, and clearcontents functions. Also, I don't want to DELETE any rows, just essentially shift the blank rows to the bottom. So when a row is cleared, all others shift up and the blank one goes to the end of the data that is available for data entry, so rows 17 to 116 are always available. But it must check to make sure that B-J and L-N are ALL blank, otherwise some wanted rows with one piece of information might get cleared. So at any given time, my range will always go from row 17 to 116. This is Excel 2007. Here is the code I have to clear rows that can be built upon.

View 14 Replies View Related

Transposing Column Into Multiple Rows

Feb 16, 2010

I've got an issue where I'm trying to transpose data from one column into several rows. I've been looking for a macro to help me out but can't seem to find a way to do this. Does anyone have any idea how I can do this?

Ideally, the macro would be written so it would find the data in the column and move it to a new sheet and then it would repeat the process throughout the document. The macro would know that the data is grouped b/c of the blanks found between the data set. So as the macro is running, once it hits a blank, it would then copy and transpose the data and continue. Does this make sense?

I've posted a sample of the info I'm working with.

View 12 Replies View Related

VBA Getting Data (5 Column To Multiple Rows)

Feb 22, 2014

figure it out thus problem with macro,

before/sample data :
name
address
gender
activity
code

[Code]...

after macro :

george
g
t
jas

[Code]...

it's possible with macro??

View 3 Replies View Related

Single Column -> Multiple Rows

Mar 5, 2014

I have a single column of about 1500 points, and I need them to be separated into many rows of 20 numbers.

I have multiple issues:

1) The middle number of each row (10th and 11th) need to be repeated. So a transpose formula can not work all the way through the 20 numbers. Unless I transpose the first ten, then tranpose the second ten. Is there an easier way around this ?

2) The bigger issue is, I would like to write a formula that can manipulate the date to enter in the correct cell.

To illustrate I will use a set of ten numbers:

1
2
3
4
5
6
7
8
9
10
11
12

INTO
1
2
3
4

5
6
7
8

9
10
11
12

View 9 Replies View Related

IF Statement To Leave Cell Blank If Multiple Cells Are All Blank?

Mar 12, 2014

I am looking for an IF statement that would leave a balance cell blank if both the revenue and expense cells are blank, otherwise a formula would be calculated.

View 8 Replies View Related

Transposing Multiple Rows To One Single Column

Apr 12, 2005

I frequently have to work with tables set up like this:

A1 A2 A3
B1 B2 B3
C1 C2 C3

All I would like to do is to transpose them into one single column:

A1
A2
A3

B1
B2
B3

C1
C2
C3

View 5 Replies View Related

Transposing Multiple Rows And Columns To One Column

Jul 27, 2013

I have a spreadsheet that calculates data in multiple columns (A:AN) and each column has 27 rows of data called "Sheet 1". As it stands, the spreadsheet goes out very far. On "Sheet 2" I would like for all of the data in "Sheet 1", columns A:AN to be "transposed" to "Sheet 2" in column A only. So, column A on "Sheet 2" would have the data from "Sheet 1" A1:A27, B1:B27, C1:C27, so on and so forth. I would like for the formatting to maintain the same order as well.

An example would be:

Sheet 1
Column A B
Row
1 Green Red
2 Blue Yellow
3 Black Cyan
4 Pink Magenta

[code]....

View 3 Replies View Related

Merge Column Data Over Multiple Rows

Dec 6, 2008

I know how to merge data in a CSV (see attachment) from 2 columns into a single cell using =A1&" | "&B2 so that A1 (Safety Products) plus B1 (Fire Protection) becomes Safety Products | Fire Protection in cell C1, but how can I do this across multiple rows so that each pair of names is combined in each row? The job I'm working with is a product CSV file that has 6370 lines so I don't want to do them one line at a time!

View 2 Replies View Related







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