Macro: Name Current Region Or CurrentRegion

Oct 28, 2006

Probably a really simple solution to this one, I'm trying to create a macro that will jump to a location, select the current region and then create a range name for that region. However, the number of rows in the region will change each time the macro is run as the region is a result of an advanced filter from a huge database. This is what I have managed so far but it to no avail

Selection.CurrentRegion.Select
ActiveWorkbook.ActiveSheet.Names.Add Name:="mergea", RefersTo:=Selection.Address

Ultimately the data selected will become a list for a Word mail merge

View 5 Replies


ADVERTISEMENT

Current Region Through A Function?

Feb 19, 2014

I am trying to get the address of Current Region through a Function call. The function only returns the address of the cell, not current region. Isn't it possible to use Current Region within a function? It works for a Subroutine. I have attached the examples in a file.

View 5 Replies View Related

Using Current.region Less 1 Column

Mar 30, 2009

How can I use this code but tell it to select all but the right-most column? I have this piece of code...

View 4 Replies View Related

Assigning Current Region To A Variable

Dec 7, 2009

I’m attempting designate the cell which will then determine the start of the current region, to be copied and pasted to another sheet. I’m receiving an “ERROR 1004” , Method Range of object_ Worksheet Failed.

View 4 Replies View Related

Trying To Select Current Region Of Name I Choose

Dec 4, 2006

I get an error 1004 with this
Sub SelectCurrentRegion()
Cells.Find(What:=InputBox("Enter the sheet name to delete"), After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
Range("ActiveCell.Value").CurrentRegion.Select
End Sub
I can put Range("G2").CurrentRegion.Select and it works fine, but I need it to enter the value from the earlier find.

View 9 Replies View Related

Limit Row Height For Rows In Current-region?

Oct 15, 2007

I have an area in my spreadsheet (the current region surrounding cell G6) in which the height for each row should not exceed a specified limit (say, 150). It's okay if the row height is less than the limit - these rows should be left alone. I only want to resize those that exceed the defined row height limit.

Is there a simple way to reset the row height for rows whose height exceeds a specified maximum row height limit?

View 9 Replies View Related

Select Current Region Ignoring Cells In Dropdown List?

Feb 17, 2014

I have a sheet with a data in range A1:J9. I have a drop down list in each cell from A2:A100.

I'm trying to store all values in A1:J9 in an array using the property CurrentRegion.value like below

Code:
Arr=Range("A1").CurrentRegion.Value
The issue is that is taking as current region the range A1:J100, even if I don't have selected any value in the drop down list from A10:A100.

Is there a way to force CurrentRegion to select only values from A1:J9 ignoring the blanks dropdown list values or a similar way to load an array with values in a contiguous range?

View 9 Replies View Related

Copying And Pasting Current Region To Another Sheet Without Actually Copying?

May 15, 2014

I want to copy the current region on sheet 3 and paste that into sheet2 starting with cell E4. But I don't want to actually use the copy method. I believe there is a way to do this. I was thinking the following:

[Code] ......

The idea I had was to simply state that cell E4 would be assigned the value of CurrentRegion on sheet 3. Is there a way to bypass the copy method?

If not, how to copy, then paste?

View 2 Replies View Related

Using CurrentRegion

Jun 10, 2006

I've been using a piece of code for a while now, but don't really understand how it works. I was hoping someone could help me disect it so I could fully understand how it works.

Sub HLight_UAJ()

Set rFormula = Sheet3. Range("S9:S" & Sheet3.Cells(Rows.Count, 2).End(xlUp).Row)

rFormula = "=IF(RIGHT(B9,4)=""0000"",TRUE,FALSE)"

Set rFilter = Sheet3.Range("A8:S8")

With rFilter
. AutoFilter
.AutoFilter Field:=19, Criteria1:="True"
.Offset(1, 0).Resize(. CurrentRegion.Rows.Count - 1, 1).SpecialCells(xlCellTypeVisible). _
EntireRow.Interior.ColorIndex = 7
.AutoFilter
End With
End Sub

I understand everything except this part

.Offset(1, 0).Resize(.CurrentRegion.Rows.Count - 1, 1).SpecialCells(xlCellTypeVisible). _
EntireRow.Interior.ColorIndex = 7

I know it highlights the entire row of the visible part of the autofilter, but I don't understand how it chooses what to highlight. I need to know how this works so I can adjust it. I don't want to highlight the ENTIRE ROW, just from Column A to R.

View 9 Replies View Related

Sorting With The Use Of CurrentRegion

Apr 24, 2006

'macro sortSales

'You will want to use the CurrentRegion property and look at
'all references to ranges. Any method that does not use an
'If statement, or anything similar, and doesn't change the
'worksheets, except by sorting, is acceptable. Be sure it would
'work on worksheets similar to these but not identical

'As you make changes to the macro, test that it still works for
'Test-Sort 1before you test it for Test-Sort 2

Sub Macro5()

Range("A1:G39").Sort Key1:=Range("D2"), Order1:=xlAscending, _
Key2:=Range("B2"), Order2:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _
xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, _
DataOption3:=xlSortNormal

End Sub

This wasn't in the lecture and I have no idea where to begin correcting it... The worst part is that I have finals all next week and I need to study for them. I usually was able to find my answers on this forum but I don't seem to be able to do that in this case... any help GREATLY appreciated!!!!

I've included the above macro in the attached file.

View 9 Replies View Related

Ommit Headings From CurrentRegion

Nov 22, 2006

Assuming I have a data martix which is X* Y. I want to store a range that is at Row Z. I have named a single cell at Row Z as "dataStart". How can I store that Row without the header?

View 5 Replies View Related

Use CurrentRegion As Source Data For Scatter Plot?

Mar 1, 2013

I have a spreadsheet in which the amount of data is not predictable. There are always a different number of rows and columns in this spreadsheet. I need to be able to grab the data that is in it starting with B1 and going to the last row and column with data and put it into a scatter plot. The code that is currently in my macro is as follows:

ActiveSheet.Range("B1").CurrentRegion.Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
ActiveChart.SetSourceData Source:=Range("ForChart!$B$1:$J$1000")

Note: ForChart is the name of the sheet where the data is housed; I have other sheets in this macro.

I know that the last line is the problem. While I figured out how to select only the data I need, when it goes to put it into the chart, it's still using an absolute reference and I don't want that. There are sometimes more columns than J and fewer rows than 1000. I want that data range to be whatever CurrentRegion selected. Is that even something that Excel can do?

View 3 Replies View Related

Determine Row Number Of Active Cell In CurrentRegion

Sep 16, 2008

I'm trying identify the active cell row number in a current region for viRows below. Currently I'm getting the active cell row number on the total worksheet.

With ActiveCell.CurrentRegion
viCols = .Columns.Count
viRows = .Range(ActiveCell.Row).Count
End With

View 2 Replies View Related

Macro To Copy Current Sheet, Create, & Rename New Sheet From Current Open Sheet

Oct 27, 2008

EXAMPLE: Complete Sheet called "Day1". When day1 is complete you click on button and it then copies itself and creates and renames new sheet to "Day2", then when "Day2" is complete you click on button and it then copies itself and creates and renames new sheet to "Day3", and so on and so forth to "Day30".

View 9 Replies View Related

Finding Current Month Total Sales Using Current Month To Date Sales In Formula / Macro?

Aug 20, 2013

Basically, I'm doing a recorded macro for work where I take an export and manipulate the data to show differences between sales from last year and this year. Also comparing this months projected sales to avg of last 6 months and also against last years this month.

The problem I'm running into is in automating the this month sales for mid-month exports. I can do it individually but I can't find a formula that will do it. Data is in one cell per month, so ex. 130 sales this month so far. I need to have it convert that to projected sales for total month based on what day it currently is.

View 1 Replies View Related

Plot By Region Chart

Jan 1, 2008

I am trying to figure out the best way to plot this data -- For each region, I want to plot December 2006 snowfall against December 2007 snowfall. So starting on row 12 to row 41 (in the attached file). First challenge: the dates are not aligned because it is using the retail calendar where 12/3/2006 is compared against 12/2/2007. How can I plot the snow depth for the Northeast for example? I can't just use a dual axis chart because there are also dual dates...

View 3 Replies View Related

Different Method For Finding Variable Region

Jan 2, 2009

I have the following

View 2 Replies View Related

Percentiles Against Each Concatenated Grade And Region

Oct 28, 2008

I have a dataset (20,000rows) with Grade, Region and Salary. I need to calculate the 25, 50, 70 and 90 percentiles against each concatenated Grade and Region.

View 9 Replies View Related

How To Count The Region By Date Wise

Feb 8, 2010

how to count the region by date wise,

For Example: Below 2 columns there are four dates available,
i want to know the count for date 1/1/2010, how many UK?, IND?, US?.
As per the below format....

Date UK IND US
1/1/2010---
1/2/2010---
1/3/2010---
1/4/2010---

Date Region
1/1/2010UK
1/1/2010IND
1/1/2010UK
1/1/2010UK
1/1/2010IND
1/1/2010UK
1/1/2010UK
1/2/2010IND
1/2/2010UK
1/2/2010US
1/2/2010US

View 9 Replies View Related

Sum Of Postal Code By Region(canada)

Jun 30, 2007

I am trying to Write a function that would add all the postal codes that contains a certain value. Overall I want the function to return the number of postsal codes that contains lets say L3T. the problem is that my postal codes are formated like L3T 6X5 - L4V 4X9 , etc. i need excel to only consider the 3 first digits/letters and return me the sum of all the L3T, L4V etc

View 6 Replies View Related

Move All Data From Worksheet To Other Based On Geographic Region

Oct 23, 2013

I have a excel file with two tabs, one with raw data, with data ordered by geographic region.

I have another blank tab, where I've created a dropdown list of the geographic regions.

How do I move all the data from worksheet to the other based on that geographic region?

View 9 Replies View Related

Retrieving Names Of Places From Google Maps For Selected Region In Excel Sheet

Nov 2, 2011

Retrieving the names of all places in excel sheet as per Google maps or visible in google maps for a selected District / State / Country.

View 9 Replies View Related

How To Use This Macro On Current Sheet?

Jul 13, 2009

I wrote this macro that will work on two named sheets but i want to copy the column from the active sheet:

View 4 Replies View Related

Calculate Maximum / Minimum Value Of Current Value Based On Current Value And Previous Value In Data

Jan 6, 2013

I have series of data values like below. I have to find Maximum, Minimum values for each of these values.

9430
9822
10070

[Code].....

View 2 Replies View Related

Macro To Insert Current Date

Jun 6, 2014

I'm working on a macro code that would create a Purchase Order number based on that day's date. So it's pretty simple since all you need to do is have a macro insert the formula:

[Code] .......

However, i don't want in the PO number any "/" or "-", is there a way to omit these? And is it possible to also make the current year in two digits and not four?

So if the PO number were to be today's date then it would look like this "6614".

View 4 Replies View Related

Macro To Sort Current Tab Worksheet

Mar 25, 2009

I basically need a macro to sort the sheet by V, U, T starting from row 3 and ending before the last vechicle. This is the problem though, the last vehicle ends everytime right before Car # in column A. So in other words in this example i would need it sorted by v u t, starting from 3 down to row 12. It ends at 12 because the next line includes car and a number.

Another sheet might have a longer list of vehicles and might end at row 100 before the next line has car number .

It always starts at 3, but the ending is dynamic where it should stop its selection before "car number ".

I would also like it to work on the current sheet im on, because i have up to 100 sheets like this and would not want it name dependant. Just want to click on a tab, and run a macro and have it sort from 3 down to the line before car in column A.............

View 3 Replies View Related

Have Macro Give Current Date

Jan 8, 2008

I'm having trouble with setting a date stamp with one. I'm creating a database in which a macro will take data from a table and compile it into a list. The first column of the compiled list should have the date the data was added (static - it shouldn't update afterwards). This is because the list will be added onto multiple times.

I found a site that sounds like what I need: ...

View 9 Replies View Related

Macro Save Current Sheet

Jun 2, 2009

I have a form button I am currently using to save the workbook. However due to the workbook being so large is taking a little longer than I want to save. Is there a way to change the macro to save the current sheet only?

Sub Save()
'
'
'
ActiveWorkbook.Save
End Sub

View 9 Replies View Related

Add Current Date When Running Macro

Nov 7, 2006

I have a macro that imports a report. In the header I'd like to display which day I imported the report, so I know I'm not looking at old data. I know I can use =TODAY() manually but I'd like to include it automatically in my macro.

View 7 Replies View Related

Determine Current Date In Macro

Nov 7, 2006

I'm trying to write a batch file that connects to a database and passes in an SQL query. One of the conditions of this query is the date. I need the batch file to figure out what todays date is and pass that in.

This is what I currently have.

ws_tran_date between to_date( '&datefrom 08:30:00AM', 'DD-MON-YYYY HH:MI:SS AM') and TO_DATE('&dateto 08:30:00am', 'DD-MON-YYYY HH:MI:SS AM')

When I run the batch file, it asks me to input the dates manaully in the format DD-MON-YYYY (eg 7-NOV-2006). I need the batch file to figure this out on it's own.

Is there some function I can call to do this?

View 5 Replies View Related







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