Selecting Non-Contiguous Cells Containing Data In A Column

Feb 25, 2014

I have a column that has mostly empty cells. I want to select only the ones that have data so I can perform an operation on all of them. Empty cells must be excluded from selection. I do not know where the bottom of the data is.

The solution needs to be in VBA where it is part of a larger macro affecting the user's worksheet.

View 7 Replies


ADVERTISEMENT

Selecting All Data In Specific Columns Without Selecting Adjacent Column

Mar 10, 2014

Using VBA, I need to Select A1:C14.

The problem is that A1:C14 contains blank cells, and there is also an adjacent column D that I do not want to copy.

So, UsedRegion and CurrentRegion aren't doing it for me. (It selects Column D too.)

Obviously, this is an example...the real data set is an export and varies in size.

View 1 Replies View Related

Export Non-Contiguous Column Cells

Feb 6, 2008

I have a spreadsheet with multiple columns. I need to save values from each specific column, but they are not non-contiguous, to a .txt or .csv file. In other words, I may need B:10, B15, B12, B25, etc. saved as one string in a text file. I have been working on this for about 15 hours and can't seem to get it to work.

View 9 Replies View Related

Select A Contiguous Range Of Cells In A Column

May 7, 2009

I'm trying to select a contiguous range of cells in a column and then iterate over that. I keep getting error "91", object variable not set. I have:

View 5 Replies View Related

How To Select An Entire Range Of Non-Contiguous Cells In A Column

Aug 19, 2009

I recently found this code for selecting a whole column of non continuous cells.

ActiveSheet.Range("a1",ActiveSheet.Range("a65536").End(xlUp)).Select
How can I change the "a1" & "a65536" so it can work and be activecell instead?

View 9 Replies View Related

How To Count Contiguous Cells If Data Equals Values

Aug 13, 2014

I have some data like the following:

2 3 4 8 4 1 3 3 1 8 1 3 5 8 1 2 5 6 1 7 9 3 3

I would like to be able to count the number of times 1 follows 8 for example. For the data above the answer is 2.

View 1 Replies View Related

Copy Non-contiguous Cells And Varying Data Types

Nov 4, 2013

I have a non-contiguous range of cells that contains Values, Formulas, Text or Dates. In some cases a field containing a value could instead contain a formula depending on who is filling out the form and/or what information is known. For example, a cell might contain a value, i.e. Utilities, and I might either know the total ($76,310), or I might need to perform a calculation right in the cell to obtain the total (=54236+9587+12487).

My goal is to be able to copy the information contained in this non-contiguous range to the right some 52 columns (this is a safe temporary storage location) and then be able to copy it back should I need to.

One other problem may be that the source cell might be a merged cell.

Since I cannot determine whether the information is going to be a value or a formula, and I have some text and date formats to copy as well, is there some way to copy this range and keep the data regardless of format?

My Range might look like: (F4, C5, D6:D7, D9, D13:D15, D17:D18, D22:D25, D27:D30)

F4 is a date field, C5 is a merged cell holding text, D6 is the Utilities field described above. The other fields are all formatted as dollars or percentages.

View 7 Replies View Related

Selecting 1 Row, While 2 Cells Of The First Column Are Merged

Jul 14, 2006

how can i (in VBA) select 1 row (eacht time, it's an ? iteration? (repeating)), while the first 2 cells are merged, like:

a b c d .....
1
2 merged
3 merged

and i need to select row 3 only

and if someone could explain me how i can use the " find" function (on another sheet)

View 5 Replies View Related

Selecting Cells Based On Last Used Column In Lower Row

Nov 21, 2008

I am inserting a subtotal above my data set, the first cell that this subtotal takes place is "R1", then I have an unknown number of subtotals going right, depending on the number of months FCSTed by my sales managers.

Attached you will find a subset of the data and you will see that I need to select "S1 : iLastColumn(1)".

View 4 Replies View Related

VBA - Selecting The Last Cell In A Column With Data

Oct 6, 2008

I am trying to write some VBA code to select a range in a column going down to the last item in the column.

So I want to write a macro that will copy cells B4 - B17 into cells A4 - A17 but am having trouble with the code that will select B4 - B17. When I use the usual code which is as follows:

ActiveSheet.Range("b4", ActiveSheet.Range("b1").End(xlDown)).Select
it selects down to A75, and I know why this is but not how to fix it.

This is raw data extracted from a third-party system. It has an option to export to Excel, but where it appears to have blank cells Excel actually believes there is data in there.

So is a way to identify what data Excel thinks is in there and perhaps use this to be able to select the range I want?

Different extractions will need a different range moved over - however it will always start at B4 and go down to B-whatever.

View 9 Replies View Related

Selecting Only Cells That Contain Data

Sep 15, 2009

when run a macro to make the macro select all the cells in a specific column that only contain data i.e. i have a spreadsheet 5 columns wide by 23 rows deep, the macro at the moment selects the 5 columns (this never changes) but the number of rows always changes 123, 56, 1, etc i need to to always select the rows that have data.

View 14 Replies View Related

Column Matching And Selecting Offset Data / VBA

Jul 23, 2014

Attempting to match values in column E with column G and insert the corresponding number (column H) into column F See attached workbook for example.

Hoping to do this using VBA, not just a VLOOKUP.

The code below, places 0 values into the correct rows of column F, instead of the correctly associated value.

Attached file: Macro Match question.xlsx‎

View 4 Replies View Related

Selecting The 2 Last Values In A Column Of Data With Range

Jan 23, 2007

I m trying to make a button to add values to another sheet in my xls. Ive done that... now i try to autofill the percentages from left and above one row....

View 9 Replies View Related

Add A New Column Of Data To The Results Displayed When Selecting From A Dropdown Box

Feb 3, 2010

I have a dropdown box to choose a category.
When the category is chosen it displays the relevant course names which corresponds to that category (this could be 1 course up to 10 different courses).
Along with that course name it gives the relevant course overview.

This works exactly how i want it to. (thanks to Zbor from a previous thread)

I now want to expand further and give the corresponding course objectives for each course that shows up in the results.

I have attached a workbook as its much easier to see the dropdown box working.

Sheet 2 is the working sheet and sheet 1 will contain all the source data.
I have highlighted the columns affected in Blue Blue column on sheet 1 will have the course objectives on the same line as the course they belong to Blue column on sheet 2 is where they will be displayed when the correct category selection is made.

The course objectives are unique to the course title and course overview.

View 6 Replies View Related

Macro Selecting Data In A Row With Empty Cells

Jul 9, 2013

I have to select and cut a column with on several lines empty cells. I use the following code

'Range("c2", Range("c2").End(xlDown)).Cut' but this code select only the data till the first empty cell.

How can I select the whole column till the last cell. The column B is filled with data on every row so I think that I have to use the offset code.

View 2 Replies View Related

Excel VBA - Selecting Dynamic Range From Multiple Column Data

Feb 11, 2014

Selecting the range from Multiple Column data.

Currently, it is:

[Code]....

I have data from columns A:E

View 4 Replies View Related

Selecting The Most Recent 10 Cells From A List Of Data To Be Included In A Formula?

Jan 3, 2014

how i can select the most recent 10 cells from a list of data to be included in a formula. I have selected it manually, for example F122:F131. This is fine but i don't know how i can put it so that it will update to the 10 most recent results when i input another line of data. So when i put in more data it stays on the previously selected. I want it to move shift down to include the new data but only the 10 most recent.

View 5 Replies View Related

Auto-Populate Column Data From Source Sheet After Selecting From Dropdown List

Jan 11, 2013

I'm trying to make a spreadsheet that can be used to easily build a collective list of steps, for a user to read and follow line-by-line.

I want a source sheet of "steps" that I can change over time, and the resulting tabs that reference the source sheet get updated/populated automatically.

I've pieced together some VBA code from other sources, which kind of does what I want it to:

VB:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row > 1 And Target.Column = 1 Then
Dim SourceSheet As Worksheet
Set SourceSheet = ActiveWorkbook.Sheets("Steps")
Dim TargetSheet As Worksheet
Set TargetSheet = Target.Worksheet
Dim c As Integer
Dim Source As Range

[Code]...

But there are some problems:

1) The data auto-populates into a row. It would read better if each step was in the same column, meaning rows would need to be automatically added upon selecting something from the drop-down list. The number of rows that need to be added vary based on the number of steps in the source sheet, for the selection made from the drop-down list.

2) If you make a change to the source sheet, my goal is to have the other sheets referencing the source sheet's lists of steps update automatically, so you only need to update the steps in one spot and everything you've built from them gets updated instantly. Currently, you must select a different choice from the drop-down list, and then change it back, before it populates the "new" steps from the source sheet.

This is my first time using VBA.

What I have so far is attached: testAutoPopulate.xlsm

View 2 Replies View Related

Code That Automatically Run After Selecting Item In Data Validation Dropdown List In Column C

Oct 12, 2011

I have a dropdown list in C24:C50 (=CategoryList) with data validation and a sub list in D24:D50 (=ItemList) with data validation. I am looking for a way to have code automatically run after selecting an item in the data validation dropdown list in column C.

Example; I click on C24 and make a selection. I what it to trigger code that would move me to D24 and open up the data validation list in D24. After the selection in D24 I would like it to move me back and down 1 row to C25. I have not found anything directly related to this but I have found that code can be run after a selection in a valadition list.

View 2 Replies View Related

Grouping Contiguous List Into Non-Contiguous Groups

Sep 9, 2006

I would like to be able to count the amount of entries in column C and depending on the amount group them in either groups of 3 or 4, all names would be unique...so if there are 14 names in the list they would need to be grouped in to two groups of 4 and two groups of 3, if there were 19 then 4 groups of 4 and 1 group of 3 etc to a maximum 50 people, the results could appearon a seperate worksheet say pasted on to the worksheet starting with the groups of 3 (so paste a group of 3 then skip 3 rows then paste groups of 4 skip 2 rows, the row skipping is to allow seperation and manual entry of extra data). There will never be groups of 5 or more and never less than 3

View 8 Replies View Related

Average Of Non-contiguous Column

Dec 24, 2008

I want to get the average of various non-contigous columns, ex:
Column B G X Z
10 0 6 8

However, I need to exclude any zero values. In this case the correct average is 8. I have used various sumif's and Average(IF) functions without success.

View 5 Replies View Related

Colouring Non-contiguous Cells With VBA

Dec 4, 2012

I have a rather large database that I'm trying to automate colours in, based on data that is inserted into Column 'D'. I've used the following code (with some success), but it colours columns that I don't want to colour:

VB:
Sub KeyCellsChanged()
Dim Cell As Object
For Each Cell In Range("D1:D5000")

[Code].....

That works fine - but the problem I have is that I only want to colour columns A:N, Q, T, V, AB:AE, etc. (random columns and not always together). I have already tried to replace parts (as follows), but get all sorts of errors (in particular Run-time error 1004):

VB:
If Cell = "Rabbit" Then
Cell.Range("A:N,Q, T, V, AB:AE").Interior.ColorIndex = 42

Is there someway that a line of code can determin which cells to colour in the row, or alternatively code that will colour the columns a specific colour and make them stay that colour when the first code above is used?

View 3 Replies View Related

Min Value Excluding 0 For Non-contiguous Cells

Apr 2, 2009

I can find the min value excluding zero in a range of contiguous cells, but how can I do it if the cells are A1, A3, A25, A67, etc?

View 9 Replies View Related

Paste Into Non-Contiguous Cells

Dec 18, 2012

Copying and pasting into non-contiguous cells.

I want to be able to filter my data set, so for example I can filter column A for the value Berkshire, I then want to be able to select all the Berkshire's in Column A (not a problem, simply select them and copy), but I then need to be able to paste them into column B, so they appear in exactly the same rows as they do in Column A, but this doesn't work, it pastes them into hidden cells as well.

I've tried the Alt + ; (Visible Cells Only) option, followed by copy and paste and this makes no difference.

I have over 20,000 rows of data to filter, then copy the relevant cells and move to the same row in another column and currently I'm having to move the cells one by one which is ludicrous.

View 1 Replies View Related

Sort Non-contiguous Cells

May 24, 2006

How would I go about sorting a selection of non-contiguous cells?

View 5 Replies View Related

Clear Non-contiguous Cells

Jul 23, 2007

Am looking for routine that can be used to delete the contents of cells from multiple, non-contiguous cells throughout a single worksheet. I would like to place a "button" or some form of toggle-switch on the worksheet that will clear all entries at once. I see a thread "Macro Deleting Wrong Cells" that references a VBA sub-routine called "DelCells". I happen to be running Excel 2007 and am still adjusting to the new menu "structure" :-)

View 5 Replies View Related

Expand Range To Include Non-contiguous Column?

Apr 1, 2014

How to make the below selected range, which represents column Q, also include column A?

Range(ActiveCell, ActiveCell.End(xlDown)).Select

View 4 Replies View Related

Specify Non-Contiguous Cells With Variable Addresses

Nov 17, 2012

Excel VBA. I have a problem which is frustrating me almost beyond measure, but I am convinced that the answer is a simple one.

sub a() copies the values of 3 non-contiguous cells and pastes them as contiguous cells. This is simple as the cell addresses to be copied are absolute.

VB:
Sub a()
Dim x As Integer
x = 6
Range("A1,C1,E1").Copy
Cells(x, "H").PasteSpecial Paste:=xlPasteValues
End Sub

Sub b() copies a range of contiguous cells, including empty cells, and pastes them as contiguous cells, including empty cells. This is simple because I have specified a "range" of cells with variable addresses.

VB:
Sub b()
Dim x As Integer
Dim y As Long
x = 6
y = 1
Range("A" & y & ":E" & y).Copy
Cells(x, "H").PasteSpecial Paste:=xlPasteValues
End Sub

However, what I really want to do is copy 3 non-contiguous cells with variable addresses similar to sub b (ie. 'A' & y, 'C' & y, 'E' & y) and paste them as contiguous cells (without empty cells) as in sub a ().

What is the correct way to specify the cells to be copied?

View 8 Replies View Related

Find Highest Value In Non-contiguous Cells..

Oct 17, 2009

I have a cricket excel sheet that contains batsmans scores over a season. These scores are kept in non-contiguous cells for each game (ie. D5, J5, P5, V5 etc..) In the cell next to the score is an option for the user to enter an '*' to denote a not out score (these are in E5, K5, Q5, W5 etc.)

I can sort out a formula to find the highest score (from D5, J5, P5, V5) and place this high score in a cell elsewhere - but what I really need to do is to check if the high score is not out by looking to see if there is an asterisk in the adjacent cell, and then place the score AND asterisk in another cell.

View 3 Replies View Related

Copy Cells From Non-contiguous Selection?

Sep 12, 2013

If I select a group of non-contiguous cells with control shift is there any way that I can shift the same selection over to the next column. For example, I have A4 and A8 selected. When I press shift and right arrow it doesn't work.

View 4 Replies View Related







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