Selecting A Range Of Cells Relative To The Current Cell

Oct 31, 2006

I would like to select a range of cells relative to the current cell and move them to the right two cells. Basically, if I were in cell A1 I want to be able to have a macro select A1 - A8 and move them over by two cells leaving A1 and A2 blank.

Excel 2003

View 9 Replies


ADVERTISEMENT

Selecting Relative Reference Range For Fill Down?

Dec 11, 2013

I'm trying to use relative references and am have having trouble with selecting a range for the fill down command.

I'd like to copy a formula down in the last column from row 1 to the last row with data. Column D is static so I can always use it to find the last row. The last column will vary; sometimes it might be G another time it might be X. I'm able to get the formula entered into the proper cell but I can't figure out how to select the range for a fill down.

If I was not using relative references and cell X1 always had the formula then Id code it like this:

'*** Find last row with data
Range("D1").Select
LastRow = Range("D65536").End(xlUp).Row
'*** Calculate length of cell in previous column

[Code]....

It's the last range statement that stops me. I haven't come up with a variation that allows me to select a range from the cell on the first row of the last column and select the last row with data for the same column.

View 3 Replies View Related

Selecting All Cells Except Current One

Oct 10, 2013

how do I select all cells from say B6 to the one above the active cell, and all the cells below the active cell, ie i want to select all cells in a column except the active cell and the first 5 cells. (in VBA of course).

View 8 Replies View Related

Excel 2013 :: VBA Macro For Selecting Current Week Range

May 30, 2013

I currently have this beast of a code running in Excel 2013:

HTML Code:
Sub OBTAIN_RAW_DATA_MACRO()
Dim NextCol As Long

'Copy data
Workbooks.Open Filename:= _

[Code] ........

However the issue lies in that once the data is refreshed, the slicers reading off the above raw data/pivots, automatically select all weeks, however this is not beneficial for the data being presented.

Is there anyway to have, once the Pivots have been updated, for the macro to then check and select current week range (beginning Monday) only?

View 4 Replies View Related

Stop Users From Selecting Another Cell Until Current Selection Receives Data

Jul 21, 2009

Amongst the several sheets contained in my workbook, there is one called 'Inspection Report'. Users fill in whatever data is required in the other sheets, and once they get to this one, they are supposed to enter a number from 1 to 3 into Cell X1 (which is currently selected) before they select anything else. Unfortunately, I am currently unable to stop them from doing what they should not be doing.

So, I would like to have a notification of some sort pop up into their face if they click or move the selection anywhere else while Cell X1 is still empty. Something like a validation would be nice.

View 6 Replies View Related

Selecting Data From A Date Range Based On The Current Date

Jun 20, 2013

I created a basic excel weekly budget and would like to know how much money I have as of todays date. on the top row I have a date range from Sunday to Saturday, so it looks like this:

09-15 16-22 23-29

with the month manually put in above it.

then below I have income and expenses with a Overall below that, so basically what I want to is see the Overall value based on todays date, not sure how to do this with the weekly range and automatic current date(which is =TODAY() as far as I know) I have attached a photo as a reference.

Budget Picture.jpg

View 12 Replies View Related

Selecting A Worksheet By Relative Reference

Mar 7, 2007

I have a workbook with 50 worksheets, each worksheet has an Alpha name (ie names of people). Rather than write some code to go through each worksheet to create a report, is it possible to write a formula in a "Reports" worksheet that reads something like

=worksheet10!f2

where worksheet10! is the number of the worksheet (as seen in the VBA project window) while the name is "Billy".

View 9 Replies View Related

Use Range Of Selected Cells As Relative Reference

Mar 8, 2013

I have a data that is split into multiple cells and needs to concatenated. Unfortunately, the number of columns wherein lies the data varies throughout the workbook. As such, I wanted to select a range of cells, define this range as the reference point for the macro, run the macro, then move on (selecting a different number of columns on the next try).

For example, I have this:

A
B
C
D
E

1

No
Not Very Far

[Code] .....

I want to select cells A1:B1, run a macro concatenated the two columns, then select cells C1:E and run the same macro to get this:

A
B

1
No
Not Very Far

[Code] ........

So far, I have this:

Code:
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Offset(5, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[1],RC[2])" '

View 9 Replies View Related

Reference Cells Relative To Activecell In A Range

Nov 4, 2008

I've been trying to get the sum of a range of cells based on their relation to the active cell. Here is the Pseudo
If the SUM of (the cell 2 rows up THROUGH the cell 2 rows up and 2 columns to the left) = 0 then .......

*****end pseudo

I think that activecell.offset is the best way to do it, but I can't figure out how to work that in a range....

Here is my code so far:

Worksheets("Generic SPC").Activate
Worksheets("Generic SPC").Range("c2").Select

'Do for all cells in the row
Do

ActiveCell.Offset(0, 1).Select
If Application.WorksheetFunction.Sum(Range( _
ActiveCell.Offset(-2, 0), ActiveCell.Offset(-2, 2))) = 0 Then
ActiveCell.Value = 0
ElseIf Application.WorksheetFunction.Sum(Range _
("ActiveCell.Offset(-2, 1), ActiveCell.Offset(-2, 3)")) = 0 Then
ActiveCell.Value = ActiveCell.Offset(-2, 0).Value
Else: ActiveCell.Value = 0
End If


Loop Until IsEmpty(ActiveCell.Offset(0, 1)) = True

******End Code

Range doesn't like activecell.offset. Does anyone know how to do this?

View 9 Replies View Related

Get A Macro To Look In A Subfolder Relative To Its Current Directory

May 28, 2014

This Macro (Located within "SWMS Auto-Fill.xlsm) scans the folder its in and transfers information into select cells within each .xlsm file it finds. However I need to move the SWMS Auto-Fill.xlsm file to the parent directory.

So I need it to scan: Workbook DirectorySection4

Code is below:

VB:
Sub Autofill_SWMSs()
Dim MyPath As String
Dim MyFile As String
Dim Wkb As Workbook
Dim Cnt As Long

[Code]....

View 1 Replies View Related

Wildcard In Path- Relative To Current Sheet

Dec 5, 2008

i am trying to do, i have a spreadsheet with 100+ tabs all with the day of the year. Jan1,Jan2,Jan3...Feb23,Feb24,Feb25... etc etc. I want to pull all of the same values for each of these sheets on a single tab (using vlookups, hlookups and reformatting the information for a macro to input all of this data into a database)

My question is, how can I put a entry form, lets call it a1 and fill in the tab i want the contents of the page to update with? For example, if i input "Jan18" in a1, all formulas on the page look for their source information on A1.

View 2 Replies View Related

Selecting Range Of Cells

Jan 31, 2009

I am trying to select a range of cells. The range I need to select starts in Cell A1. I need to select every row with data in column 1 up to the first row with no data. I then need to expand the range to all columns up the last column with data, including columns with blank cells.

The problem with my code relates to the selection of columns. It is only selecting up to column F. Column G is empty, Column H has data, Columns I-J are empty, Columns K-R have data.

View 5 Replies View Related

Selecting Non Sequenced Cells In A Range

Mar 1, 2010

I'm trying to use the SUM function with non sequenced cell but the Range or any other function won't allow me to activate the selecting cells if there are more then 41 cell, I wrote somthing like so:

Sub Test()
Dim str AS String
Dim R AS Range

str = "A1,A3 ...... ,A57" 'this is only an example, assum that there are _
more then 41 cells
Set R = Range(str) 'Here is the Problem, I get a Runtime error 1004 _
Application-defined or object-defined error
R.select
End Sub

But if the str input was a 41 or less Cells address string then it works

View 9 Replies View Related

Select Cell Range Relative To Starting Position

Mar 5, 2007

I need to change multiple conditional formats which apply to cell ranges 1 row x 17 columns wide. The specific change I am making is able to be acrried out with the code

With Selection.FormatConditions(1).Font
.ColorIndex = xlAutomatic
End With

However, I dont want the user to have to manually select each 17 cell area. I WANT THE USER TO JUST MANUALLY SELECT THE FIRST OF THE 17 CELL AREA. I want to write a macro that will THEN select a row of cells, 17 cells long, from the MANUALLY SELECTED position as at the moment of running the macro. Unfortunately the cells are not always on the same row in each sheet. On one sheet they may be on row 5, on another row 8 and on another, row 15 etc. I was wanting to be able to select a 17 cell range 'relative' to where the cursor is. How do I write the code to select the relative cell range? Is there an answer in an R[1]C[1]:R[1]C[17] sort of code?

View 7 Replies View Related

Ctrl-A Selecting Limited Range Of Cells

Apr 8, 2009

I have a spreadsheet wherein if I press ctrl-A (normally Select All) it is only selecting a limited range of cells ($B$12:$M$22). If I press ctrl-A again from there then it selects all.

I can see something like that being useful in some cases and annoying in others, but I have no idea what is causing it. Some of the cells in that range are locked and others are not. Some of the cells outside that range are also locked while others are not. In any case, the sheet is not protected.

View 3 Replies View Related

Selecting A Range Of Cells With R1C1 Notation

Oct 31, 2008

I'm trying to select a range of cells using the R1C1 notation. But I'm making an error in the syntax. I know it's really simple, I just don't know what's wrong.

View 2 Replies View Related

Current Date In A Range Of Cells

Jul 13, 2014

Macro that will perform the following.

Search for the current date in a range of cells and then select the cell next to it.

View 6 Replies View Related

VBA - Setting Paste Of Series Destination Range Relative To Active Cell

Oct 24, 2013

I'm creating a Macro to paste a series of formulas from a template in hidden rows above to cells further down in the same worksheet. My code works fine if I set an absolute range as the Destination - here's a portion of it:

Sub TimelineRow150()
Dim TimelineMatch As Integer, ProjectPlan As Object
TimelineMatch = ActiveCell.Offset(0, -1).Value
If TimelineMatch = 26 Then
Range("E26:AQ28").Select

[Code]....

I'd like to be able to copy and paste this code to run it multiple times in the same worksheet, (the TimelineMatch variable actually has 26 different options). Is there a way to replace the [Range("E150:AQ152").Select] portion of the code with a range that is relative to the Active Cell? (I'd instruct users that cell E be the Active cell before running the Macro, and E to AQ is still the range I need the copied data to appear.) I've tried using ActiveCell.Offset, but I keep getting an error of Method 'Range of Object' _Global' failed.

View 3 Replies View Related

Color Row Based On Fixed Cell & Relative Cells

Apr 15, 2008

My sales spreadsheets have a column which is turned to 100% when the order comes in (i.e. when the salesman gets it in his commission). I have applied conditional formatting to turn the whole row green when this happens (for ease of seeing which orders are in)

We also have a cell for the Purchase Order "number" (as these come from the customer, these can be a straight number sequence - "12345" or a mix of letters and numbers - "ABC12345"). My boss would like this cell to be red if the "order in" column is at 100%, but there is no PO number.

However, when I put in the formatting:
(1) =$K$15=1 (to turn the row green)
(2) Cell Value is equal to 0 (to turn the cell red)

it will apply (1) no problem, but will only apply (2) if (1) is false. (i.e. if (1) is true, the whole row goes green, with no red in the PO box.)

If I switch them round (i.e. have (2) first), then I get the formatting that I want (i.e. green row with a red box), but if (1) is false, I still get a red PO box.

What I need is a way of only applying (2) if (1) is true. (or any other way of only making the PO box red if the order is 100% but there is no PO number)

View 5 Replies View Related

Selecting The Rest Of The Current Column Then Copy To Another Worksheet

Jul 11, 2006

I have part of this routine working correctly. It will go and find the value I need and move to the next column using the Offset method, but now what am I doing wrong to try and get the code to select to the end of the current column?

Sub Find_First()
Dim FindString As String
Dim rng As Range
'FindString = InputBox("Enter a Search value")
FindString = Worksheets("Template").Range("A26").value
If Trim(FindString) <> "" Then
With Sheets("Service Level Score Paste Sheet").Range("A:A")
Set rng = .find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
rng.Select...........................

View 8 Replies View Related

Excel 2007 :: Automatically Selecting Cells - Highlight As Range

Jul 29, 2008

I'm new to Excel 2007... whilst I'm managing to find most things I'm used to using in 2003, I have an issue in one workbook that I can't figure out.

When I click in some single cells (not all), that cell and several below it automatically highlight as a range... left-clicking initially highlights the cell, but as you release the mouse button, the others below it also highlight.

View 14 Replies View Related

Selecting One Cell Copies Range

Aug 15, 2008

Question 1) Is there a way that whenever I select Cell B39 that it will copy cells B39:V39 ? From there I can manually paste that selection to where I need to.

If this is possible, it would save the effort of having to select B39:V39 manually and clicking CTRL-C. I am gathering data and the copying and pasting is killing me.

Question 2) Is it possible that when I click on Cell A9 that it can paste any data that I just copied from another worksheet to cells A9:D29? The size of the selection that I would copy is the same size as A9:D29 (4 columns & 29 rows).

I have searched for a solution, but I am not having much luck since I am anaware of the proper terminology for these types of actions.

View 10 Replies View Related

Selecting A Range Based On Cell Value

Oct 24, 2008

how (in VBA) to select a range within a column where all values are the same?

For example, given the following:

A B
1 ID Value
2 1 A
3 2 A
4 3 A
5 4 B
6 5 B
7 6 C

How would I select range(B2:B4) where all values = A?

View 14 Replies View Related

Randomly Selecting A Cell From A Range

Oct 14, 2008

I need a cell to display the (text) content of 1 of 25 cells. example: I have text content in all cells ranging A1:A25. I want cell B1 to display the content of 1 of these at random. is there a function for this or do I need to use a macro?

View 4 Replies View Related

Selecting A Range Based On The Value Of One Cell

Feb 27, 2009

I have rows of data, and the first number corresponds to the number of subsequent numbers that are relevant.

I want to paste that number of values into a second spreadsheet. How do I do this?

e.g.

A1 B1....
6 21 15 14 32 85 14 16 21 25 26 24

In this case I want to copy the 2nd-7th number, as the 6 tels me I want the next 6.

View 9 Replies View Related

Selecting Cell Range Of Colours

Oct 21, 2009

Is it possible to select only cells of a certain colour, then change these cells to a different colour? example

I want to make the dark grey columns a light green and the red columns a lets say yellow and the text black. Is this possible??

View 9 Replies View Related

VBA - Selecting Active Cell And Working Back To Specific Cell Range?

Jul 2, 2014

I have a form that loads and depending on the word selected in the drop down the following code loops through cells Q2:AC2 until it finds the word in one of those cells (the word will always be in one of the cells)

Code:
For Each c In Range("Q2:AC2").Cells
If c = period Then
c.Select

[Code]...

The active cell it finds will always change, i know I need something to code the active cell back but I don't know what it should be.

View 5 Replies View Related

Selecting Range From Cell Selected Till Row 1?

Jul 29, 2013

If Cell "B55" Cell is selected and I want to Select all the above rows to select till Row 1. Selected Row mught change Say B66 or B82 (Dynamic)

Whatever may be the Cell Selected, The result should be The above rows should get seleted. So that I want to delete the rows easily

HTML Code:
ws.Range("B55").Select
Range(ActiveCell, Activecell.Offset(-55,15)).Select
'This cannot work if the selected Cell is 65, So this should be Dynamic till above Range 1)

View 2 Replies View Related

For Each Cell In Range Put Current Row Into String

Sep 15, 2014

In the code below how do I get the Current ROW number the "For Each Cell in Rng" is processing

I tried "cRow = rng.row" but it's only showing the starting row not the current row of CELL

VB:

Sub Process Range()
Dim startCol As String
Dim startRow As Long
Dim lastRow As Long
Dim lastCol As Long
Dim myCol As String

[Code]...

View 2 Replies View Related

Populate Cell With Current Time When Specified Range Changes

Jun 2, 2007

i have this excel sheet that am using as a monitoring device to track the login and log out patterns of a group of 20 agents. i am able to monitor their current state by using an external link to the local intranet and vlookup.

the status of agent can be either Logged In or Logged Out which populates in E6 to E25.
the cells f6 to f25 again running vlookup shows the last login time of the agent.

what i'm looking for is this:
every time the agent status changes from Logged In to Logged Out or visaversa, the corresponding blank cell in the row needs to populate the the time by value.

View 9 Replies View Related







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