# Find Column Number From Search Pass To Integer Cell Reference

Jul 21, 2007
I am building a Workbook which takes data from SheetA and inserts it into SheetB.

Part of the data is only entered when a positive value exists.

I then do an export from SheetB.

The problem is that I need to get the column number and pass it to the cell reference based on the field name in row 1.

Dim sFindstring As String

Dim rFindcell As range

Dim iR As Integer

Dim iC As Integer

sFindString = " Find this string in the cell"

'Using cells find the findstring

Set rFindCell = Cells.Find(What:=sFindString, After:=[A1], LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious)

'OK so look here

iR = 3

'I am trying to pick up the column number

iC = rFindCell.Column

rFindCell throws an object or with block variable not set error. Is there some property that I need to set.

View 3 Replies
ADVERTISEMENT
Aug 4, 2007

I am trying to create a macro (please look the attached excel what I have done), I have already crwated a macro that after 5 seconds is gonna change the background color of the of the cell en function of another cell.

That means if F3:F4 change the background color F8:is going to change the backgorung color also, every 5 seconds. The macro I wrote is also include in the excel attached file.

Now this is my problem... I have a variable cell that is give for D6 which could be A,B,C,D,E,F (Range F2:K2).

If the variable cell D6 is A the background color of F8:F9 should be the background color F3:F4 .

If the variable cell D6 is B the background color of F8:F9 should be the background color G3:G4 .

If the variable cell D6 is C the background color of F8:F9 should be the background color H3:H4 ......and etcetera.

View 5 Replies
View Related
Feb 12, 2014

I am trying to search through column "I" for numbers that are decimals, when the first decimal is found, use the row number that the first decimal appears in the string that populates the bookmarks stored in a word template I have created. The code I have so far checks for the decimal and then populates the bookmarks, however it requires me to input the ranges manually, meaning I can set them as the first row in my tabel. But if the decimal appears in the second row and not the first I'm bookmarking the wrong data. Here is the code I have so far;

[Code] ........

View 3 Replies
View Related
May 8, 2014

I have M106 = 4

I need a simple formula to convert that into column Alphabet + 1

So 4 will be Column E (A,B,C,D and 4th will be D+1= E)

View 3 Replies
View Related
Feb 5, 2009

Cell A1 = 3

Cell A2 = 4

Is there a formula to calculate

(3*4)+(2*4)+(1*4)

I need to multiply every integer less than the number in cell A1 and greater than zero by the number cell in A2. I was thinking factorial, but that's not it... Can't remember from my math days.

View 3 Replies
View Related
Aug 12, 2007

This line in my code is causing an invalid qualifer error message:

lngNew = wsNew. Range("B65536").End(xlUp).Row.Offset(1, 0)

Option Explicit

Sub Disney_DumpData()

Dim wbBook As Workbook

Dim wbNew As Workbook

Dim ws As Worksheet

Dim wsNew As Worksheet

Dim rng As Range

Dim rngNew As Range

Dim rngUnit As Range

Dim rngUnitPaste As Range

Dim lngNew As Long

Dim Cnt As Integer

Application. ScreenUpdating = False

Application.Calculation = xlCalculationManual

Application.DisplayAlerts = False

Set wbBook = ThisWorkbook

Cnt = 0

'Dump To New File

'/Define new workbook

Set wbNew = Application.Workbooks.Add.....................

View 7 Replies
View Related
Dec 27, 2006

I am just wondering if there is a way i can search an excel workbook for a particular reference number. eg

name reference money

dave 60056835 £20.00

clare 50065755 £30.00

If i want to search for Ref 60058635 i just want to type it in and excel will the search the workbook and direct me to the correct page and column.

View 14 Replies
View Related
Jan 28, 2014

I need to reference a different workbook in a while loop. Each iteration, PopFive increases by 3, as I want to pull the numbers of every third row. How does the syntax of the line go after the " ! "?

[Code] ......

View 1 Replies
View Related
Jun 2, 2008

to update these values via a form in this sheet. I can find the correct row to be edited by entering a value from column A and B. The problem is if I want display the values of that row first and then change it. If I want to change row 10 data how can I bring back the value in ROW 3 AND THE COLUMN VALUE? The next step would be to do the actual update if I want to change ROW 10 to "Ooi" and a sales value of 200?

This is what I have done so far:

Dim myRows As Integer

With Sheets("Mrt")

'Retrieve history information for row

For myRows = 4 To 49

If comboxDay.Text = Range("A" & myRows).Value And textboxdescription.Text = Range("B" & myRows).Value Then

textboxbedrag.Text = Range("C" & myRows).Value

chkBTW_Ja.Value = Range("D" & myRows).Value

txtNota.Text = Range("S" & myRows).Value

End If

Next

End With

Picture attached to show how sheet looks like.

View 9 Replies
View Related
Aug 15, 2008

Following statement works for me:

bdcTerm1 = ThisWorkbook. Sheets("ws2"). Range("A1").Value

But instead I want to parse through 50 rows and dynamically get the value instead of using a static Range("A1"). So I am trying to do the following:

For Row = 1 To bdc_rows

bdcTerm1 = ThisWorkbook.Sheets("ws2").Cell(Row, 1).Value

bdcTerm2 = ThisWorkbook.Sheets("ws2").Cell(Row, 2).Value

Next Row

But I get errror.

View 5 Replies
View Related
Sep 20, 2007

How do I use VBA to send the value of a cell, for example, cell J77 to the variable "mastervalue1"?

I have a spreadsheet that has a column with dates ( in the format "mmm-yy") and next to it a column that has values. I want to pass the value of the cell that is next to the date cell that contains today's month to a variable in VBA. Auto Merged Post;here's an example of my spreadsheet

View 9 Replies
View Related
Aug 18, 2007

I am setting a variable to the value of an absolute cell reference. I want to set the value of another variable to just the row value of that absolute cell reference.

View 4 Replies
View Related
Aug 24, 2007

I have uploaded a copy of the spreadsheet I am working on and have completed the user forms and coding for march the 1st only, so if you test, please use the options march and then the 1st!

The problems i have is, when I enter a number into a text box and press next page, the numbers fill where i want them to but the cells do not recognise them as numbers, therefore conditional formatting doesnt work! Even if I change the cell properties to numbers, this does not remove the error!

Second problem!! If a user forgetts to enter a value in a box, or they wish to edit just one value, and go back into the user form to change a figure, when they press next page, all the values in the column seem to disappear!

View 6 Replies
View Related
Oct 5, 2007

I use the code below to enter a value from a list box in a cell on a workssheet. Is it possible to code VBA to enter a number for the position of the selection in the listbox to a cell in a worksheet rather that the actual value from the list box. For example if my list is:

Option1

Option2

Option3

And I click on Option2 in the list, I can sennd the value 2 to a cell on the worksheet rather that the value "Option2' from the list.

Private Sub ListBox1_Click()

Sheets("SA").Range("SA_Poistion_To_Archive_A_New").Value = ListBox1

End Sub

View 2 Replies
View Related
May 23, 2014

file storage

1. Look at the "Days so far" section

2. Ignore cell C1

3. All the other cells in that row are shaded blue. Look at these.

4. Look at the "Volunteer" row - all the cells in that row are shaded blue. Look at these.

5. Wherever a name - any name - appears in the "Volunteer" row, 1 is added to the previous number in the "Days so far" section and the result is displayed in cell from the "Days so far" row above that Volunteer's name.

6. For example, we begin in C1 with a count of 12 days so far - this was manually entered

7. In cell H5, we see Henry has volunteered 1 day. The total no. of days so far should now be 12+1. Therefore, the number in H1 should be 13.

8. In cell G47, we see Joseph has volunteered 1 day. The total number of days volunteered BEFORE Joseph volunteered is 15 (see cell D43). But now, with Joseph volunteering 1 day, the total no. of days so far should now be 15+1. Therefore, the number in G43 should be 16.

9. what formula l must put in the "Days so far" row (excluding cell C1, which is manually input) to give me the "should be" results predicted in that row? I'm guessing it will be a formula which looks at each row fragment of the "Days so far" row, row by row, right up to the previous cell in that row, all within one formula.

P.S. I just want to leave the "Days so far" row blank, for any columns where there are no volunteers in the "Volunteer" row, so please don't give a formula which inserts zero for days with no volunteer, and then sums the cumulative total.

View 5 Replies
View Related
Oct 30, 2006

I want to use the value of the last cell as a starting value and add a number to it and assign it to the next cell.

i have this

Sub a()

For i = 15 To 100

Cells(i, 2).Value = Cells(i - 1, 2).Value + 6

Next i

End Sub

how do i incorporate this

Sheets("Sheet1").Range("A").End(xlUp).Offset(0,0).value

into the code above so that the value of the last cell can be the starting value.

View 3 Replies
View Related
May 6, 2009

I need to find a formula that will find letters in a referance, for example i have referances like - MNE DJM & ZZPAR i need to find a formula that will find me the ZZPAR looking for "ZZ" i then want this to tell me what tpYe of referance number it is and put this into column Z.

Normal referance number like DJM and MNE i want this to show as "BROMLEY"

aND ZZPAR as "Chester"

I have tried something like the following but this is not working

View 5 Replies
View Related
Oct 14, 2013

I am trying to find the last cell with data in a spreadsheet once this has been found select all up upto cell A4 and then format these cells into number format to zero decimal places so far I have the following which finds the last cell:

LR = Cells(Rows.Count, "A").End(xlUp).Row

Range(Cells(LR, 1), Cells(LR, "A")).Select

View 1 Replies
View Related
May 24, 2006

I needed to know how to find the closest match to a reference number

regardless of whether its larger or smaller. I did a search and found a post

back in March that said to use the following:

=SUMPRODUCT(((ABS(list-target))=MIN(ABS(list-target)))*list)

I applied it to my application and it works, I just have no idea why. Can

anyone explain this formula to me or tell me where I can find a good

resource.

View 11 Replies
View Related
Dec 5, 2009

I've been trying to put together a VBA code that allows me to find a number between 1000 - 10,000. I am able to find any number below 999 but can seem to find anything above 1000. I've been using the following ....

View 13 Replies
View Related
Aug 6, 2013

I am working on an existing large excil file with over 60 sheets. What I want to do is create a search box on the first page, our "main menu." The search is for an product ID Number and then will open up the sheet in which that ID # is associated with.

View 9 Replies
View Related
Jun 6, 2014

I would like to create a VBA macro which would do the following:

There will be three columns A, B, and C. Each cell in each column will have a number with two places after the decimal. Each integer corresponds to a letter code. In the fourth column (D), I would like the letter codes from the corresponding three numbers in the same row to be combined in one cell as follows (if possible):

It is important that the macro only pay attention to the whole number, and ignore the numbers after the decimal. However, the numbers after the decimal must remain in the chart.

A

B

C

D

[Code]....

View 3 Replies
View Related
Oct 12, 2009

How to make A1= A2xA3 and round the result to the higher integer that can be divided by 6 ????

View 3 Replies
View Related
Feb 15, 2010

I have a range in column A. which will vary time to time.

I need to find the row reference(say A99) that is end of the range. Then I need to use that row ref in another formula.

How to do this without VBA?

View 9 Replies
View Related
May 23, 2006

I am having trouble getting my IF statement to test if the cell contains the text "sale" return "X" if not "Y". I need it to search through the text string in that cell and find a certain word, and if it finds that word, retrn a value. I am really having difficulty with is what symbol or function do I use for the logical test? (i.e. =, <>, MATCH, INDEX?)

View 4 Replies
View Related
Jun 19, 2014

I have a monthly report. Worksheets for each month, each row is a type of fruit (column A), and the number sold (column B). A new worksheet is added each month with the information. I also have a Summary worksheet - running total of all months: Type of Fruit (column A), Number sold (column B), and Total of all fruits - number sold. I would like a formula for the Summary worksheet - to match that fruit (column A) to any of the other worksheets - matching the fruit (column A), and bring back the number sold (column B). (note some apples are Fuji and some are Honey crisp - those would be totaled together)

ex:

Tab = Jan 14

Fuji apples3

Bananas2

grapes9

TOTAL14

[Code]....

View 2 Replies
View Related
Jan 29, 2007

I am trying to write a code enabling some calculations. As part of this code I want to find an integer in an excel range. I set the variable (integer) as Rvalue and wrote the following:

Selection.Find(Rvalue).Activate

which works fine as long as the find is successful. The issue I have however is when the variable cannot be found. I tried using the "iserror" function in vba but it appears that excel/vba does not recognise this issue as an error; I could use an excel formula (i.e. if(iserror(vlookup...) but I would prefer to find out how to handle the issue in vba.

View 2 Replies
View Related
Oct 18, 2009

I have a file here included which has 8 + columns. I normally have to go through each column and find when the references start and delete everything below it. If i could have a macro find where the references start in each column and delete on down that would be a huge time saver.

#REF!

#REF!

#REF!

#REF!

Thats the example of the reference i run into, i was thinking of a macro to find where the REF starts and delete that cell and everything on down.

View 11 Replies
View Related
Aug 31, 2009

I have a table of some numbers, and along the left side is a column representing what each row of data is. So in this case, it is a list of letters. What I'm doing is in each column of the data, I find the maximum number, and then I want to have it list below that what letter that maximum number is from. Here is an example:

View 2 Replies
View Related
Jan 30, 2014

Any method to determine the number of instances a value ("4" for example) appears next to a specific value ("x" for example). I don't have a workbook; I'm just looking for any formula that can search for specific values and find the total number of instances that an adjoining cell contains data.

View 14 Replies
View Related