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


ADVERTISEMENT

Determine If Cell Is Number & Round

Jul 27, 2007

It's been awhile since I've done this...and I tried searching for the solution but to no avail.

I'm trying to edit the contents of a series of numbers by using the Rounding function. When I execute my macro on the next cell, it uses the value of the original cell when the macro was created. Here's a copy of my macro:

Sub RoundTest()
'
' RoundTest Macro
' Macro recorded 7/26/2007 by Aramark Uniform Services
'
' Keyboard Shortcut: Ctrl+l
'
ActiveCell.FormulaR1C1 = "=ROUND(2103.86,0)"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub

View 6 Replies View Related

Determine If Cell Value Is In Number Array

Feb 16, 2008

1. In column A i have a list from 1-12 (months in a year)
2. In column B i have the formula that references the corresponding cell in column A in the same row i.e. B1 "=(A1={1;3;5;7;8;10;12})"

Problem: This formula works only when the value in column A equals "1"...i need it to work when it equals any of the identified numbers in the set.

View 2 Replies View Related

How To Determine If Number Formatted Cell Is Empty And Not 0

Feb 21, 2014

if the active cell is formatted as number and I write

x = Cells(Row, Column).Value

and the cell is empty or blank, x will be set to 0.

How can I determine that the cell is blank and not actually 0 ?

View 9 Replies View Related

Determine Whether Cell Contains A Number Formatted As Text

Jan 2, 2009

How can I interrogate the contents of a cell to determine whether or not it contains a number formatted as text? I intend to run a .value = .value over each such cell to convert it to a number format, but I only want to do this to relevant cells.

View 9 Replies View Related

Use Active Cell For Row Number

Nov 22, 2006

There is a chart encompasing column A, B and C. The column D has certain numbers stored in its cells. All I wont is to build a code which would check the value of the cell in column D which is in the same row as the active cell, and then paste certain date into the active cell - basing on the value of the cell in column D.

Here an example:

Sub pasteif()
first one) column D has
'if the value is i.e 2 then it should paste into the active cell whatever there is in Range F1:G1
'if other value is present in this case in cell D1 (it is always the D column) then other range would copied into the active cell
Range("F1:G1").Copy
ActiveCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub

View 2 Replies View Related

Row Number Of Active Cell

Aug 5, 2008

I need to write code which would find the row number of my selected range (named 's')and then select the row beneath that.

View 3 Replies View Related

Get Active Cell Row Number From Another Sheet?

May 3, 2014

How do you reference the active cell or the current selection on another sheet to get the row or value?

View 13 Replies View Related

Force New Active Cell When Maximum Number Of Characters Is Reached

Jan 16, 2008

We have a form that requires descriptive comments to be entered into several rows of merged cells. My goal is to have the form be able to automatically dropped down to the next row of merged cells when the current row of merged cells reaches a maximum number of characters.

And finally, the last row of merged cells would not allow any more characters than the maximum assigned but not advance to another cell automatically.

The rows I am working with specifically are:
Merged Cells F23:R23; A24:R24; A25:R25; A26:R26;...A29:R29

View 5 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

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 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

Excel 2003 :: Highlight Cell On Same Row As Active.cell Whenever Active.cell Changes

Dec 10, 2012

whenever the active cell is within a given range, highlight the cell on the same row in column S (by changing its interior colour). This should occur each time the active cell is changed, whether by cursor keys or mouse. The effect would be similar to the row and column highlights at left and top of the worksheet.

This action should be restricted to one sheet in the workbook.

It's for Excel 2003.

View 3 Replies View Related

Selecting Range From Active Cell To Last Entry In Same Row As Active Cell

Jun 8, 2014

I have got stuck on one piece of my code and having trouble fixing... Overall I am trying to find variable station name in cell L2 of Sheet 2 in Sheet 1 and then select and copy the data from the data in "cell L2 of Sheet 2" to the last entry of that row. I have attached an example test spreadsheet of the data and a macro is within Sheet 1 called test1. Please note that cell L2 in Sheet 2 will always be different station name and the station list in Sheet 1 will change with differing station name.

The code I am using is:

[Code] .....

The code that is not working and bringing up an error is:

[Code] .....

Attached File : Copy of Testexample.xlsm‎

View 2 Replies View Related

Determine Active Control On Multipage Control

Oct 4, 2007

How do I determine which control the user is currently modifying on a multipage form (either changing, enterying or exiting the specific control). when I use "userform1.activecontrol" i get "multipage1" as the control name but I need the actual control on the specific active multipage. (also the .TABINDEX is for the multipage regardless of the on-page control) I use a generic data-field change SUBroutine so need the control name (and the TABINDEX) to provide my SELECT CASE. (so every fieldname_CHANGE calls the same SUB [with no parameters])

View 3 Replies View Related

Determine If Last Character Is Number Or Not A Number

Oct 23, 2008

I'm trying to determine if the last character of a cell is a number or not a number. So in a cell I may have a string like:

ZXC123

or

ZXC123A

If the last character is not a number I want the letter returned. So I thought I could use a formula like: =IF(NOT(ISNUMBER(RIGHT(D88,1))), RIGHT(D88,1),""). However for the string ZXC123 it still returns '3' so anyone have any ideas how I can do this?

View 2 Replies View Related

Determine If Number Is A Prime Number

Sep 25, 2009

I have a column of random number in Column A and need a formula to identify if any of the numbers in Col A is a prime number. If it is, then say "Prime" in the cell adjacent to the prime number in Col B. Eg if A12 has a value 17, then cell B12 should say "Prime".

View 9 Replies View Related

Determine If A Number Is Even Or Odd

Jan 20, 2007

Determine If A Number Is Even Or Odd. i would like to Determine If A Number Is Even Or Odd...?

View 3 Replies View Related

Determine Page Number

Apr 29, 2008

Is it possible to programmatically determine the page number on which a specific cell will print?

View 14 Replies View Related

Determine Row Number Of Last Value In Column

May 15, 2009

Trying to do a simple workbook here, with hopefully no macros/VB script.

Essentially, I want a cell to display the row number (-1 to take into account the heading) which has the last value contained in it.

The workbook is a list of users that have signed up in 1 month, and is distributed to staff for a particular reason.

The cell I'm trying to create is part of a 'stats' section.

View 7 Replies View Related

Determine Row Number Of A Specific Value

May 13, 2007

I have a worksheet that contains active rows and hidden, inactive rows. On occasion, I would like to unhide an inactive row. I intend to do this by running a macro which will generate an input box to enter the file number of the row in question. I can restore the row, but what I am unable to find a solution for is converting the file number to the row number to be restored. The file numbers reside in column A, so if I input file number 2300, I need the macro to look through column A, find the cell that contains the value 2300, and return (as a string?) the row number that contains that value. From this I can have that row returned to visible status.

View 9 Replies View Related

Determine Next Number In Order

Dec 21, 2007

We have list for entries that is shared among few people. In that list, we manually add number for the entry. So if I input 99 then, next person should add 100 and so on. I would like to automize this, so say If I use this, then no one else can use it in the mean time and then when number is input, it should disallow if same number is input and it should automatically enter the next number.

View 3 Replies View Related

Determine If Range Is Divisible By A Number?

Aug 24, 2012

I have a report of time balances that employees enter. I need to run a macro that looks at each cell and determines if the number is divisible by 4. (We only track vacation and ill time in 4 hour increments) If the number the employee entered is not evenly divisible by 4, I want the cell highlighted.

All of this I have figured out, the loop to look at each row, the IsNumeric function to test if there is a number...

My problem is with the MOD. I figure I should be testing number MOD number, but it is not reliable.

4.1 Mod 4 returns 0
.5 Mod 4 returns 0

I just need it to return zero if the number is evenly divisible by 4.

I considered the RoundUp function, but then it would also round anything above 3 hrs to 4, and that won't work.

View 3 Replies View Related

How To Determine Number Of Pages To Print Out

Sep 2, 2013

I have client sheets that need to be printed at the end of each month. Sometimes I need 1 sheet, sometimes more. I have a macro which pops up a userform in which I can select the client I want to print and the month. I would like to be able to have the macro determine how many pages need to be printed so I get all the pages and do not end up with any blank pages. Is this possible?

View 1 Replies View Related

Determine If Whole Number Exists Between Minimum And Maximum Value?

Feb 14, 2014

I have two columns of data with a minimum value in the first column and a maximum value in the second column. What I'm trying to get is an indicator in a third column which tells me if a whole number falls at or between the minimum and maximum values. Here is a sample of my data:

A1 B1 C1
0 0.1 TRUE
0.2 0.5 FALSE
0.6 0.8 FALSE
0.9 1.2 TRUE
1.3 1.6 FALSE
1.7 2.0 TRUE

View 7 Replies View Related

Determine Number Of Files In Dynamic Directory?

Feb 6, 2014

is it possible if I have a directory like the following

[Code].....

with .csv files which are placed in arithmetic order 01,02,03 etc to determine if one .csv file is missing and print an error that this file is missing? I think that if I knew how many files I got I would create an array and check one by one the files.. But in case I have a dynamic directory and the number of files is not the same all the time , is this possible?

View 2 Replies View Related

Determine Number Of Workdays Per Week In Given Month

Dec 6, 2013

Is there a formula I can use to determine the number of work days in each week for a given month. The work week would start Sunday, with Friday and Saturday as days off. Each week would be in their own row.

i.e.

January

Week 1: 2 days
Week 2: 5 days
Week 3: 5 days
Week 4: 5 days
Week 5: 3 days

[Code] ..........

View 4 Replies View Related

Determine Number Of Logical Pixels Per Inch

Jan 18, 2009

How can we determine Number of Logical Pixels per Inch based on the system configuration using API and return the value to Cell A1 of Sheet1.

View 9 Replies View Related







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