Select Adjacent Range ..
Jul 30, 2008I only want to select the adjacent range from
Range("A2", Range("A2").End(xlDown)) to the left
I only want to select the adjacent range from
Range("A2", Range("A2").End(xlDown)) to the left
I have a series of data values in non-adjacent columns in an excel spreadsheet.
In the following example, assume the | (vertical bar) refers to the start of
a new cell:
F|45|A|30|F|15|F|10
Using the SUMIF formula, I want to add all numbers which are preceded by a
cell containing the letter F.
SUMIF(A1:G1,"F",B1:H1)
What I need to do is specify a range of every second cell in the row (starting with Cell A1) for validating they equal F, and a range of the alternating cells (starting in column B1) for the range containing the data to add. How can I specify these ranges (I can't name each cell individually as I have more than 30 cells to add up in my real life situation and the IF function allows selection of no more than 30 values)?
I've always been able to select non-adjacent cells in spreadsheets, but today noticed that I can't. I need to be able to do so to collect data from one spreadsheet to another for my monthly accounting reports. It makes collection of specific data fast and simple. Without this function, it takes far longer to do reporting and is very un-reliable. With the function working, I click on the cell ranges which are black, leaving the cell ranges which are red alone. We use black and red to identify charges which appear or do not yet appear on our monthly VISA statement.
I select all the black charges along with their corresponding account codes, then double-check the page before copying the non-adjacent ranges to make certain that all of the charge amounts and account numbers which are black on the page are selected and no red ones; then copy and paste the data into another sheet. It often makes collection very quick and easy.
When there are lines interspersed throughout a sheet with black and red charges strewn here and there, it is very easy to select only the black data and skip the red. Doing so by copying the entire range then deleting the red is laborious, and time-consuming.
What has happened to Excel's ability to select non-adjacent cells? Today, I can't select even two separate cells, using Excel's ability to do so by holding down the CTRL key, as I have in the past.
I'm using Excel 2007, on Windows Vista 64 bit; and I've made sure that my Insert function is turned off (thought that might change things?) and my Scroll Lock is turned off (I've bumped that many times in the past and found Excel doing weird things when trying to navigate a spreadsheet with the arrow keys).
If I write some VBA that selects a specific cell, for example the highest value in a coumn of data, how do I then copy a given (say 3) cells above and below (and including) this selected cell.
View 6 Replies View RelatedHow would you select cell values from differing rows based on the name in an adjacent column. ie, if it says John, add that data to the source data, if not move on.
View 5 Replies View RelatedI have this:
Private Sub CommandButton1_Click()
Worksheets("Sheet1").Activate
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveCell.PasteSpecial
End Sub
it errors to: SELECT METHOD OR RANGE CLASS FAILED
Converting old reports to usable excel format. I am having trouble using VBA to set up a looping macro that would search Column A for cells with the text string: "ACTIVITY TOTAL". If cell has that value I would like to perform text to column action on the adjacent cell (R0C1). The macro recording for the test to column settings i need is :
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, OtherChar _
:=":", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1), Array(6, 1), Array(7, 1)), TrailingMinusNumbers:=True
I have attached a sample of what I am currently working with. The actual file has roughly 6000 lines of data, so I would like the macro to go through all lines.
Attached File : LoopingVBA.xlsx
I am working in excel 2010. I have a tracking document that lists free tickets and their expiry dates. In the adjacent columns we track redemption details of these free tickets. What I want to do is return the oldest expiration date from A only if the ticket has not been used (i.e. B is empty). This will allow me to see the date the upcoming tickets about to expire so we can make sure they are used.
A________________B
Expiry Date________Redeemed by
15/08/2014
15/02/2014
15/08/2014________John
15/02/2010________Marc
15/02/2011________Bob
I want to put a range select statement to select a cell and count down 10 cells and copy.
View 9 Replies View RelatedI have a command button on sheet MASTER. When the workbook is Activated I want it to check and see if in sheet COSTM, cell B3 there are the words "Project Number", if so then show command button (ClearPrevious), if not, don't show. Also, when the If statement is finished, then the workbook needs to end up showing the sheet MASTER. I have tried various codes and none work, or they are on perpetual loops. I know this has got to be simple, but cannot find an example to take from to solve the issue. Would appreciate any help offered. Below is code I have right now.
Private Sub Worksheet_Activate()
If Sheets("COSTM").Select Range("B3").Select = "Project Name:" Then
Me.ClearPrevious.Visible = True
Else
Me.ClearPrevious.Visible = False
End If
Sheets("MASTER").Select
End Sub
I am trying to use defined range names in a vlookup function. The target ranges contain non-adjacent columns. The formula wizard gives me an error msg "#value" and the vlookup returns #N/A.
View 2 Replies View RelatedMy workbook holds a month template and sheets for each month. I work on modifications in the template ,but would then like to update all the monthly worksheets. I recorded a macro to show me how to start programming the vb sub, but get a runtime failure 'error 1004 Select method of range class failed' when trying to select the column to copy,
View 4 Replies View RelatedI want a cell to countif the sum of two adjacent cells is greater than the number in another cell so for instance
Count if f101+g101 is greater than the number stored in cell u12, repeat this for cells f102+g102, right down to f50100+g50100.
I have three columns (A to C) with contineous data (# rows always variable).
I would manually type a number in a cell (S2) that would correspond with a number in Column A. What I would like the code to do is that it finds the number in column A and selects the whole range in column B and C starting from that row, and copies that whole selection to N10.
After that all the data in column N should be substracted with a value given in S3 and all data in column O with a value given in S4.
I am using code that will copy several formulas in adjacent cells to the end of range; however, when I try to use it to select and copy formulas in non-adjacent cells, I get an error. Tried to modify, but I'm new to VBA...still learning. Here is the code that I currently have.
Dim LastRow As Long
LastRow = Range("A65536").End(xlUp).Row
Range("D3").Formula = "=RC[4]/RC[3]"
Range("F3").Formula = "=RC[-1]*RC[1]"
Range("J3").Formula = "=RC[-1]/RC[-3]"
Range("D3,F3,J3").Copy Range("D3,J" & LastRow)
Split from: Clear Range To Right Of Active Cell Down. I was working through this the first step was to clear the contents of the cells. After they are cleared, I have another sub that then goes and retreives a unquie number and places it back at the top of the column that I just cleared. Would this same code that cleared the cells contents work to copy the contents of the active cell down that same column, until the cell to its right is blank? -R-
View 5 Replies View RelatedI am new to VBA and have tried to develop the code for finding a specific stock symbol (Column A) from over 4200 symbols from a downloaded csv file, copy the data in in its (specific symbol's) row (in the next 5 columns B to F) to the 3rd blank row in the master workbook (data arranged from Bottom to Top). In the Master workbook each stock symbol has a worksheet with its symbol as the tab e.g. BHP.AX is the tab or sheetname for BHP stock in the Australian Stock Exchange. The downloaded file comes from a subscribed site EODData which provides daily OHLCV (Open/High/Low/Close/Volume) data against each symbol.
My attempt is shown below and it is very primitive. It does not work! I wish to run it from the Master workbook (name:-0PortfolioASXMultipleIB.xlsm) and not from Csv Data file.
VB:
Sub Macro0CopyFromCSV()
'Insert a blank row and format it in Master workbook
Rows("3:3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
[Code] ......
I am looking for a formula that searches a range of data and then returns the sum of the numeric values in the adjacent cells. I have a calendar style spreadsheet with 2 columns for each day. In the first column it has a list of names and the second column a number.
I would like a cell to return the sum of the numeric values next to each name. All the names are entered into the columns randomly and are unorganised. The same name will appear multiple times in the range and have different numbers next to it each time. I am currently using (for example) =COUNTIF(H6:AL14,"bob") to tally up the number of "bobs" but really what i want to do is find a formula that in plain english does:
Search a range of columns and where cell = "bob" take the value of the adjacent cell (to the right) and total them up!
i have attached an image - i hope it makes sense what i'm trying to do - i would like Q3 to total up the numbers to the right of all "bobs" across all the days - so it should return 42
I'd like to sum a range of cells if the date in the adjacent cell is last month, so... A2:A1000 holds the dates and B2:B1000 holds the values, i'm trying to figure out how to sum all of the values for the previous month (i.e. June).
View 7 Replies View RelatedWhen i press say a command button " Add Repair Information" i want the User to Enter the serial number which i have given it a range called SerialN from the excel sheet and enter a repair action. Is there a function in Excel which will allow me to search the Serial Number and allow me to put the Repair action across in the cell on the same line?
View 5 Replies View RelatedI can solve my problem with a pivot table, and with VBA easily...however, I'm interested in knowing if this can be done with formulas (array formulas using index/match I'm assuming).
Goal: On sheet1 I have one column with products, then the column next to it will have an "Y" in it if the product is to be selected (blank if not). On sheet2 I want to create a list of the products that were selected (having the "Y"). The only thing stumping me is that I do not want spaces between the product list on sheet2...just a nice continuous list. Example:
Sheet1
cup Y
bowl Y
spoon
fork
knife Y
Sheet2
cup
bowl
knife
..not..
cup
bowl
knife
I have a workbook with 30 worksheets. Each sheet has 84 rows of data (start in 15 columns (A to O). I would like to create a summary sheet that only shows the most important data from each sheet.
The summary sheet would have 12 lines of headers and formatted crap at the top.
The Summary sheet header columns would be:
Site (A), Date (B) Health (C), Status (D), Critical (E), Task (F),
Dependencies (G), Owner (H), T-Date (I), Task Date (J), Mitigation Date (I)
The data in the sheets are not in that order, of course.
That
1. puts the name of the sheet I am copying from in column A
2. the deadline date in Column B (that date is always in C10 of each worksheet)
3. and copies Cells from Column A,B,G,H,I,O in any row in which the value in A is not "good" into columns C through H. I would like to paste those rows into the summary sheet. I have code that loops through the sheets and rows in each sheet to find the rows to copy. I can copy cell values directly from the active sheet to the summary sheet, but because I am copying a cell at a time, it takes 7 minutes. Yes I am impatient :)
Here is the code snippet where the copying is done:
Dim sh As Worksheet 'current worksheet
Dim DestSh As Worksheet 'worksheet in which to paste summary
Dim Last As Long
Dim CopyRow As Long 'row to copy
Dim LastCopyRow As Long
[Code] ........
ExitTheSub:
Application.Goto Sheets("KMARollup").Cells(1)
End Sub
I think there must be a way to use ranges to build an array of cell values and paste only once but I am lost here.
I'm trying to select a range that will be changing by column. I'm not sure why my syntax isn't working. What I've got:
View 2 Replies View RelatedMedian Indirect: I would like to find the median in a range of cells and then bring back the 2 adjacent cells
Range...............Adj Cell 1............Adj Cell 2
1.......................L1......................L2
2.......................P3......................P4
3.......................O9......................010
So the median of the range is 2, thus we would want the formulas to bring back P3 and p4
Column 1..............Column 2
P3...........................P4
I'm trying to create a macro that can lookup values down a list, find that value within another list and copy the adjacent cells.
The values to look for will always be on the same column and the values to look into will always be in the same range or columns but not always in the same row.
For example.
AI:AI contains a list of ID's which will be manually input every day so they might have a different order.
C:AF has all the data to look into. C always being a list of ID values and I want for every ID found on AI:AI to be search for on C:C: and then once a match is found, I need specific adjancent cell values to be copied next to the ID found on AI.
The values that need to be returned are found on columns B,D,F,G,H,I,J,P,AF and they will always display on those columns.
I've been doing this based on vlookup and INDEX/MATCh formulas but I've come across some limitations for something I want to develop further so I'm trying to do this based on VBA.
I am trying to write code to select a range in a worksheet where the last cell in the range is variable.
Sub DataTest()
Dim LastColumn As Integer
Dim LastRow As Long
Dim LastCell As range
[Code].....
i want information on my "Intra-op tab" to automatically populate on my "Tissue" tab. In Column "A" of my intra-op tab i enter case id's, 1 per row, and i would enter a date received under column "D". On my "Tissue" tab, i also enter those case id's under column "A" but i would have multiple rows of the same number. I want that whenever i type a specific case id on my "Tissue" tab, it will automatically fill in the date in column "T", the date that coincides with the case id in column "D" of my "Intra-op Kit" tab.
View 1 Replies View RelatedI know I'm not too bright, but I've really lost it here. Can someone give me the sintax to select all cells between two names: Start thru End
View 5 Replies View Relatedif my excel file data in column a:h, and in column a is date data in every day. i try to know how to write vba code in the case of selection data by the date, that i want to select for any propose (copy or printing). eg. date data "dd/mm/yyyy" when i put it to input box
I'm trying to select a range of dates, contiguous from "AZ2" until the last entry using the following lines. The last cell in the column is selected instead of the entire range of dates from "AZ2" until the nth cell. I'm using Excel 2007. Below are the lines I'm using:
View 3 Replies View Related