How To SET Column Range Of Sheet Using Column Number

Jun 16, 2012

I have to SET sh1, then activate sh1 before I can SET rng1. Is there a way to just...

Set rng1 = sh1.Range(Columns(1), Columns(11)) ' why doesn't this work?
Sub Raw_Sales()
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim rng1 As Range

[Code]...

View 1 Replies


ADVERTISEMENT

Range Object/property: Calculates 2nd Column Based On 3rd Column's Number

Jun 1, 2009

I'm trying to write a code that calculates 2nd column based on 3rd column's number or vice versa based on the condition set on the 1st column. Below, there are two procedures. "SimpleCalc" and "SimpleCalc2". I first wrote SimpleCalc2, but it isn't working, so I worked around the error by writing SimpleCalc, which selects a cell and moves around by offset. I personally find it hard to read and error prone as I develop more logic around it.

I'm trying to develop more function based on this code, so I need to make it neat and flexible. what I'm doing wrong in SimpleCalc2? Or do you have any suggestion to improve the code "SimpleCalc"? I'm using Excel 2003.

Sub SimpleCalc()

Dim SimpleMethodRng, SimpleMethod As String, i As Integer

ActiveWorkbook.Worksheets("Dashboard").Range("P5").Select

SimpleMethodRng = ActiveWorkbook.Worksheets("Dashboard").Range("N5:P12")

For i = 1 To 8

SimpleMethod = SimpleMethodRng(i, 1).........

View 3 Replies View Related

Return The Column Number Of First Column In A User Inputted Range?

Feb 19, 2009

I'm creating a macro that creates a co-ocurrence matrix from variables that are adjacent to each other.

In order to proceed, I need to know how to return the column number of the first (leftmost) column in a range that the user selects.

View 2 Replies View Related

Copy Or Move Column Ranges From 1 Sheet To End Of Column Range Of Another

Mar 7, 2008

I have two different Excel reports and the data needs to be copied from each column on one spreadsheet and pasted to the bottom of the equivalent column on the other spreadsheet.

So, is it possible to get a macro that will copy the data from one column then paste it to the next free cell in the column on the other spreadsheet.

If I could get some code to do one column then this should be enough to get me started and I could apply this to the other columns I need to copy.

View 8 Replies View Related

Select Range Of Current Column To Last Column In Sheet

Jan 30, 2012

I'm trying to make the below two column selections into a selected range to clear out formulas/values in the range.

Current code segments:

ActiveCell.EntireColumn.Select
Columns(ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column).EntireColumn.Select

Is there a way to combine the two code segments into one selected range?

View 6 Replies View Related

Autofit Column Range By Column Number

Dec 17, 2012

I've been trying various syntax for an hour now and I cannot figure out how to reference a range of complete columns by column number.

I know this works

Code:
Worksheets(strWS).Columns("B:I").EntireColumn.AutoFit

But the number of columns is dynamic, so I don't know which one is the end. So I have the column number but cannot figure out how to reference the column range by number. I have tried versions of the code below but they all give different errors. This one is Run-time error 1004 Application-defined or object-defined error.

Code:
Worksheets(strWS).Columns(Cells(1, 2), Cells(1, lngLastCol)).EntireColumn.AutoFit

I am pretty sure I am close but the referencing is the issue. I can find all sorts of referencing by letter but not number. I've tried

Code:
Worksheets(strWS).Columns(Columns(2), Columns(lngLastCol)).EntireColumn.AutoFit
but I get the same error.

View 2 Replies View Related

If (Column A) Within Date Range Then Add Number In Column C

Oct 22, 2009

I'm still confused regarding a complex formula - rather n00b. Using Office 2007 with XP. Can't figure out with help or previous questions.

The following is what I would like this formula to accomplish. Picture included below.

Take all the values of column of C and add them together if and only if the corresponding date value in column A is during the month of January (and February, March, and so forth).

Event DateNameTotal Amount2/21/2009$4,5002/22/2009$04/3/2009$04/25/2009$9,0004/30/2009$8,3005/2/2009$9,0005/7/2009$5,5005/9/2009$9,0005/12/2009$3,000

View 9 Replies View Related

Look Up In Column A Of "AS" Once It Find That Number I Need It To Return The Number Thats In Column E Of That Row To Sheet "IS"column D

Nov 20, 2008

i have 2 sheets one called "IS" and the other called "AS" in cell a2 of "IS" is a number that i need to have excel look up in column a of "AS" once it find that number i need it to return the number thats in column e of that row to sheet "IS"column d. summary: a2 of "IS" looked up on sheet "AS" and returns the number in column e to cell d2 of "IS"

View 3 Replies View Related

That Takes From Manual Sheet The Number In Specific Column And Multiply It By The Percentage In Sheet

May 29, 2009

I'm trying to create a formula that takes from "Manual" Sheet the number from colume G2 and multiply it by the percentage in sheet "AllocationRule".

My formula currently is =Manual!$G$2*AllocationRule!$B5.

What needs to happen is that the total number in "Manual" needs to be distributed evenly in 4 rows by the percentages allocated in "AllocationRule".

Right now I can't copy my formula over to the sheet because the "AllocationRule" should stop at B5 and not go further and the G2 from "Manual" should not change for the percentage allocation but should change to the next row for the next month.

And then after I've done the calculation I want the LOB in "AllocationRule" to be displayed in the LOB in "H1913_H1914" but I'm not sure what formula to use.

View 7 Replies View Related

Column Number From Range Name

Dec 9, 2009

I have named ranges in my excel sheet.I wish to however find out the column number from each of the names and use it as a variable for later calculations.How do I do this?

View 9 Replies View Related

Copy Column Value From One Sheet To Another With Path Of Sheet Specified In Range?

Feb 26, 2014

I need to copy columns b,g & h from workbook1 to workbook 2 c ,e, f

workbook1 is the path mentioned in cell A1

Workbook2 is the path mentioned in cell A2

View 1 Replies View Related

How Can I Check A 4 Column Range For A Particular Number

Jan 11, 2009

I would like to check a 4 column range to see if a particular number has been added to a range of number.

this is the formula that I wrote but it does not test beyond the 2nd column.

=IF(OR((MATCH(3,COLUMN_D)),(MATCH(3,column_c)),(MATCH(3,column_b)),(MATCH(3,Column_a))),3,"")

Does anyone have an different way of check for this?

View 12 Replies View Related

VBA Code To Take Number From Column Put It In Another Sheet And Update To Populate Value

Jan 28, 2014

I've got a big file with a large dataset. One of the sheets works as a screening for the data, so everytime I populate an ID number in say cell C3, the rest of the sheet updates as per the formulas I have in place. However, I need to write a code that takes ID numbers one by one from a sheet, populates them into my screening sheet, updates the sheet and saves it.

View 4 Replies View Related

Copy Column Range To Another Sheet

May 8, 2008

I'm trying to write a DO, LOOP that simply starts at a cell, goes down the column and copies one by one each cell into another sheet until the next cell isempty.

here's my

Sheets("source").Select
Range("A41").Select
Application.CutCopyMode = False
Do Until IsEmpty(ActiveCell.Value)
Selection.Copy
Sheets("active orders").Select
Range("D1").Select
ActiveSheet.Paste

Loop

It currently just loops infinitely because it isn't selecting the new row down (A41 is always full). I'm not sure how to offset the row within the doloop as well as offset the rows to paste accordingly in the new sheet....

View 4 Replies View Related

Vlookup (search All Of Column A For The Highest Number In The Range)

Sep 4, 2009

I WANT it to search all of column A for the highest number in the range (which will change daily to a new high number above the highest currently), and return the value in column 4 (column D) that corresponds to that value from column A. This is what I have, but it is not working, it is giving me the number (1) in Cell A800 (which is the lowest valued number in my range. The numbers range in value from 1 to 762 with none repeating (they are sequential). The formula I have is :
=+VLOOKUP(MAX(A76:A2000),A76:I2000,4)

View 2 Replies View Related

Convert Column Number To Letter From A Range Objec

Jul 7, 2009

Is there an easy way (without writing my own conversion function) to get the column letter from a range object, as opposed to the column number?

View 5 Replies View Related

Multiply Column Of Values By A Random Number Within Range?

Apr 20, 2012

I have a column of values I need to multiply by a random number (percentage) within a range of numbers (15%-22%).

How can this be done?

View 1 Replies View Related

Row Number Of Last Date / Time In Column (Dynamic Range)

Feb 4, 2014

I have a long (~42,000) list of dates and times (some including zeros). I would like to name these ranges and use a formula to find the last entry in each column. I know the lists will never go over 45,000.

The data is in this format:

1/31/14
23:58:00
1/30/14

[Code]....

The data will not always be consecutive, so I imagine the criteria would be something like (if there were such a thing) "ISDATE" or something of the sort.

How would I write a formula to dynamically calculate the row number of the last date or time in the column? (In this case, it would be 6.)

View 9 Replies View Related

Combine Found Row Number With Column Letter To Become Range And Then Count

Jul 8, 2012

I am having troubles finding a row number, using it to specify a range and then counting the cells containg values in that range.

This is what I have

Code:
Private Sub TextBox1_Change()
Dim test1 As String
Dim FoundRom As Range
Dim i as String
Dim abc1 As Range
Dim Core1 As String

test1 = TextBox1.Value

[Code] ........

I am thinking that I have my "Dim"'s wrong or something but I cant figure out how to define the range including the found row number and then count the number of cells containing data within that range...

View 8 Replies View Related

Check All Column From One Sheet And Then Update Another Sheet If Column Match

May 14, 2013

I have a sheet1 with following column name Ab,Bb,Cb,Db,Eb,Fb and sheet two contains Ab,Xc,Eb,Sv,Db,Fb,Gm,Cb,Hb these headings are on 7 line of both excel sheet.

Now I want to check each cell under column name Ab in Sheet1 and compare it with all the cells under column name Ab in Sheet2. If both matches then update Cb,Db,Eb,Fb of Sheet1 to the corresponding columns in sheet2 for that column name.

View 1 Replies View Related

If Statement + Vlookup: Fill In The Third Column On Sheet 2 From The 3rd Column In Sheet 1??

Oct 7, 2009

I need to fill in the third column on sheet 2 from the 3rd column in sheet 1. do I need an IF statement combined with vlookup??

sheet 1
mark l XYZ l 45
katy l ABC l 3
mark l ABC l 6
katy l XYZ l 45
mark l DEFl 4

sheet 2:
mark l XYZ l
katy l ABC l
mark l ABC l
katy l XYZ l
mark l DEF l

View 4 Replies View Related

Copy Data From Column In One Sheet To Column In Another Sheet Until Blank In F

Mar 25, 2014

I have a worksheet, "District", that has names of team members from A2:A (The number of team members will vary, so I would need the macro to stop when the list ends). I need these to be distributed to column A on another sheet, "Input", from A11 down until it hits a row that has a blank cell in column F. I've tried a couple of things, but just can't seem to get it to work.

View 14 Replies View Related

Populate ComboBox With Specific Sheet Column Range

Mar 4, 2008

I am attempting to populate a ComboBox ( named "SRnumber2") on a userform (named "UpdateSR"), but have hit a brick wall. The following testing code was working but now it is not:

Private Sub UpdateSR_Initialize() 'This section of code initializes the drop-down boxes.

'Add list entries to SR Number combo box. The value of each
'entry matches the existing SR Information spreadsheet entries in column "A"

Sheets("SR Information").Select

SRnumber.ColumnCount = 1
SRnumber.RowSource = "A2:A200"
SRnumber.BoundColumn = 0 ...........

View 9 Replies View Related

Highlight Highest And Lowest Number In Range Of Cells Several Times In Same Column?

Jul 28, 2014

need to understand the easiest way of highlighting the highest and lowest number in a range of cells several times in the same column.

As I said the cell range will be in the same column. So highlight the highest number green and lowest number red in cells a3 to a9 and then repeat the same process again in cells a11 to a17 and so on.the cell references are an example.

So I have several separate sets of numbers in the same column.

View 3 Replies View Related

Conditional Formatting (largest Number In Column B The Hotel In Column A Should Be In Bold)

Oct 18, 2008

when the largest number in column B the hotel in column A should be in bold.

So in excel language IF(Number in B Is Max display corresponding hotel in column A as BOLD. But I can't figure out how to do this.

You can see here on the image:
additionalimage.gif

View 4 Replies View Related

Add Number 1 In Adjoining Column When Existing Column Has Amount Highlighted In Green Or Red

Dec 27, 2012

I have a spreadsheet with sales which I colour green when they are outstanding and red when they are despatched. I would like to automatically add a 1 in an adjoining column when the cell is green (eg outstanding) or zero when they are despatched so that it totals up the number of outstanding orders.

a b

172.95 (this column would be green)
024.00 (this cell would be red)
124.00 (this cell would be green)
132.25 (this cell would be green)

View 3 Replies View Related

Automatically Applying Custom Value / Number In One Column Dependent On Another Column

Apr 8, 2014

I work in a factory where we create different types of units daily. Below is a list of planned production on a specific date, say today's date. This is a very crude example, with information missing, and it is important to know that there are conditions attached such as:

The types are added randomly. The amount of types is much greater meaning that each type is on it's own page with breaks between. Everything produced on this date will have a URN (unique reference number) with its first 6 digits equating to yy-mm-dd and the last two being the position of the unit in the production sequence (first=01, second=02 etc).

I have gotten it to the point where if you enter them in sequence (Type A first for example) it will lookup to see the last assigned URN and taking the quantity into account issue the correct URNs.

The issues I have are when the URNs are less than "10", there is a problem displaying the 0 before the digit which disrupts the sequence. I can provide more clear examples if required.

Type A
Date08/04/2014
QtyURN
101314040801-03
203514040804-08
462114040809

123914040810-19
Total18

Type B
Date08/04/2014
QtyURN
245114040820

290114040821
689114040822

Total3

Type C
Date08/04/2014
QtyURN
1111414040823-36

211214040821-22
675514040823-27

Total21

View 2 Replies View Related

Formula That Advances Column Number While Being Dragged Down Single Column?

Jan 14, 2014

I am creating a tool that is populating information off of another excel document and presenting the information in a different format then the data originally appears. Basically I am unsure how to create a formula, for example, in cell A1, that as I drag it down (A2, A3, etc) the column letter in the formula advances but the row number remains the same. In another words as the formula moves into cell A2, the "Sheet1!D3" changes to "Sheet1!E3", where as normally it would advance to "Sheet1!D4". I just started back up in excel, im sure this is way easier then I am making it seem but I have been unable to come up with a solution.

View 4 Replies View Related

Return Column Header Based On Column Criteria And Number Value

Feb 7, 2014

I have the following sample data set and I'm trying to return the appropriate column header based on criteria (i.e. DDD) and a number value which will be somewhere within the range of the table. In example below, the value returned should be Header 2 because the value is greater than those in Header 1 column (range H9 to L26).

Here's data table:

CriteriaHeader 1Header 2Header 3Header 4
ZZZ5.0015.0050.00130.00
ZZ5.0015.0050.00130.00
Z5.0015.0050.00130.00
YYY5.0015.0050.00130.00
YY5.0015.0050.00130.00
Y5.0015.0050.00130.00
DDD5.0015.0050.00130.00
DD5.0015.0025.0075.00
D5.0015.0020.0065.00
RRR5.0015.0015.0045.00
RR2.5010.0010.0030.00
R1.503.0010.0025.00
UUU0.751.505.0020.00
UU0.751.505.0020.00
U0.751.505.0020.00
P0.751.505.0020.00
T0.100.105.0018.00

CriteriaNumberValue
DDD10.00Header 1>>>=INDEX($I$9:$L$9,MATCH(I29,INDEX($I$10:$L$26,MATCH(H29,$H$10:$H$26),)))

View 3 Replies View Related

Name Range Of Worksheets And Find Duplicate Data In Column In Each Sheet

Jun 11, 2013

I have made up 7 worksheets that are completely identical with exception of course to the data they contain. I have a master sheet that contains some of the data from each of the other sheets that will be shared between them. Things were working very well until I discovered that some data was duplicated on a couple of the sheets; and I am in need of adding more worksheets.

The formula I am using for this will not allow me to have more than the 7 worksheets. It is an IF statement array. So now I am wondering how will I be able to add these extra sheets. I would like to use my worksheet names in a range but have evidently done something wrong and could not get that to work before, ending up with this very long 'IF'. !Can worksheet names be used to create a named range?

Also, I would like to know if there is a way to prevent duplicate data on these sheets. I am using conditional formatting on each sheet now, but that of course only works on the current sheet.

View 4 Replies View Related







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