![]() |
Tried the following and still can't get it to work
I'm the one trying to do the if a=b the copy c to d .......I appreaciate all
the help I got............ I put the macro into the VBA of the file (someone told me how to do the VBA programming)......... problem is and I feel really stupid here..... I'm not sure what the variables are..... here is the suggested statement. Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = Range("B1").Value Then Range("D1").Copy Range("E1") End Sub I am no longer trying to jump from different sheets. Just different areas of the same worksheet. Is .Value a variable or part of the formula? I assume Range is a predesignated range I have created. Next. Once I have it set up in VBA. How do I save and execute it? I went all through the VBA help files and nothing says how to save or execute a program created ....... I need this to repeat for about 900 rows of data and in 8 columns. I'm determined. I know this can be automated. Please help...... I'll consider naming my first born great great grandchild after you (other first taken already). Marie |
Tried the following and still can't get it to work
On May 27, 2:01*pm, Marie wrote:
I'm the one trying to do the if a=b the copy c to d .......I appreaciate all the help I got............ I put the macro into the VBA of the file (someone told me how to do the VBA programming)......... * problem is and I feel really stupid here..... I'm not sure what the variables are..... here is the suggested statement. Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = Range("B1").Value Then Range("D1").Copy Range("E1") End Sub I am no longer trying to jump from different sheets. *Just different areas of the same *worksheet. *Is .Value a variable or part of the formula? *I assume Range is a predesignated range I have created. Next. *Once I have it set up in VBA. *How do I save and execute it? *I went all through the VBA help files and nothing says how to save or execute a program created ....... I need this to repeat for about 900 rows of data and in 8 columns. I'm determined. *I know this can be automated. *Please help...... I'll consider naming my first born great great grandchild after you (other first taken already). Marie The .Value just refers to the value in the range. For example, if cell A1 contains "Fred", the the VBA statement Range("A2").Value will return "Fred". Nw, the code you have been given will execute any time a change is made in the worksheet where this code exists. However, just judging by what is listed here and not seeing any of your other posts, why is a formula not being used? Seems like you could just place a formula in E1 like below and then paste down column E as far as needed. In E1: =If(A1=B1,D1,"") With the above formula, if the value in A1 is equal to the value in B1, then the value of D1 will be displayed in E1. If A1 is not equal to B1, then nothing will be displayed in E1. |
Tried the following and still can't get it to work
hi,
Right click your sheet tab, view code and paste this in. It takes the used range of column A and loops through every cell in that range and then if A1=B1 then it copies D1 to E1. If I've got that the wrong way around then in the 2 offset statements swap the ,4 and ,3 around. The best way to run it is after you've pasted it in close VB editor then on the worksheet Tools|Macro|Macros Select 'This Workbook from the drop down Highlight then macro name Click OK Sub stantial() lastrow = Cells(Rows.Count, "A").End(xlUp).Row Set MyRange = Range("A1:A" & lastrow) For Each c In MyRange If c.Value = c.Offset(, 1).Value Then c.Offset(, 4).Value = c.Offset(, 3).Value End If Next End Sub Mike "Marie" wrote: I'm the one trying to do the if a=b the copy c to d .......I appreaciate all the help I got............ I put the macro into the VBA of the file (someone told me how to do the VBA programming)......... problem is and I feel really stupid here..... I'm not sure what the variables are..... here is the suggested statement. Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = Range("B1").Value Then Range("D1").Copy Range("E1") End Sub I am no longer trying to jump from different sheets. Just different areas of the same worksheet. Is .Value a variable or part of the formula? I assume Range is a predesignated range I have created. Next. Once I have it set up in VBA. How do I save and execute it? I went all through the VBA help files and nothing says how to save or execute a program created ....... I need this to repeat for about 900 rows of data and in 8 columns. I'm determined. I know this can be automated. Please help...... I'll consider naming my first born great great grandchild after you (other first taken already). Marie |
Tried the following and still can't get it to work
Try this
Sub test() Range("d1").Select Do Until Selection.Offset(0, -3).Value = "" Selection.Value = "=IF(RC[-3]=RC[-2],RC[-1],"""")" Selection.Offset(1, 0).Select Loop Range("a1").Select End Sub On May 27, 11:18*pm, JW wrote: On May 27, 2:01*pm, Marie wrote: I'm the one trying to do the if a=b the copy c to d .......I appreaciate all the help I got............ I put the macro into the VBA of the file (someone told me how to do the VBA programming)......... * problem is and I feel really stupid here..... I'm not sure what the variables are..... here is the suggested statement. Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = Range("B1").Value Then Range("D1").Copy Range("E1") End Sub I am no longer trying to jump from different sheets. *Just different areas of the same *worksheet. *Is .Value a variable or part of the formula? *I assume Range is a predesignated range I have created. Next. *Once I have it set up in VBA. *How do I save and execute it? *I went all through the VBA help files and nothing says how to save or execute a program created ....... I need this to repeat for about 900 rows of data and in 8 columns. I'm determined. *I know this can be automated. *Please help...... I'll consider naming my first born great great grandchild after you (other first taken already). Marie The .Value just refers to the value in the range. *For example, if cell A1 contains "Fred", the the VBA statement Range("A2").Value will return "Fred". Nw, the code you have been given will execute any time a change is made in the worksheet where this code exists. However, just judging by what is listed here and not seeing any of your other posts, why is a formula not being used? *Seems like you could just place a formula in E1 like below and then paste down column E as far as needed. In E1: =If(A1=B1,D1,"") With the above formula, if the value in A1 is equal to the value in B1, then the value of D1 will be displayed in E1. *If A1 is not equal to B1, then nothing will be displayed in E1.- Hide quoted text - - Show quoted text - |
Tried the following and still can't get it to work
I love you....... everyone had me going from SF to Seattle by way of
Nebraska...... the hard way. I knew it had to be a simple if/then statement. THANK YOU! THANK YOU! I've been working on this one for two weeks........ I am eternally in your debt. "JW" wrote: On May 27, 2:01 pm, Marie wrote: I'm the one trying to do the if a=b the copy c to d .......I appreaciate all the help I got............ I put the macro into the VBA of the file (someone told me how to do the VBA programming)......... problem is and I feel really stupid here..... I'm not sure what the variables are..... here is the suggested statement. Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = Range("B1").Value Then Range("D1").Copy Range("E1") End Sub I am no longer trying to jump from different sheets. Just different areas of the same worksheet. Is .Value a variable or part of the formula? I assume Range is a predesignated range I have created. Next. Once I have it set up in VBA. How do I save and execute it? I went all through the VBA help files and nothing says how to save or execute a program created ....... I need this to repeat for about 900 rows of data and in 8 columns. I'm determined. I know this can be automated. Please help...... I'll consider naming my first born great great grandchild after you (other first taken already). Marie The .Value just refers to the value in the range. For example, if cell A1 contains "Fred", the the VBA statement Range("A2").Value will return "Fred". Nw, the code you have been given will execute any time a change is made in the worksheet where this code exists. However, just judging by what is listed here and not seeing any of your other posts, why is a formula not being used? Seems like you could just place a formula in E1 like below and then paste down column E as far as needed. In E1: =If(A1=B1,D1,"") With the above formula, if the value in A1 is equal to the value in B1, then the value of D1 will be displayed in E1. If A1 is not equal to B1, then nothing will be displayed in E1. |
All times are GMT +1. The time now is 09:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com