Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
Hi Tim,
Are you getting an error? Did you record a macro, you don't need to make a selection, and to process only one cell or even one column doesn't seem to warrent a macro when you can use a worksheet function to keep things up to data instantly. Wouldn't simply putting a formula into Sheet2!d1 suffice? =IF(sheet1!A1=0,,sheet1!A1) --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "timothylee" wrote in message ... I am trying to get data in sheet1 a1 (10) into sheet 2 d1 and it wont run - can you tell me where I am going wrong please? Sub ad() If Range("sheet1!a1") < 0 Then Range("sheet2!d1").Select Range("sheet2!d1") = Range("sheet1!a1") End If End Sub -- TIM LEE tax agent 55 807 001 4a 123 Colin St West Perth 6005 Tel 08/9481 0337 Fax 9321 0036 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
Tim,
If Sheets("Sheet1").Range("A1")<0 then Sheets("Sheet2").Range("D1")=Sheets("Sheet1").Rang e("A1") End If This should work regardless of which sheet you are on. regards, Don "timothylee" wrote in message ... I am trying to get data in sheet1 a1 (10) into sheet 2 d1 and it wont run - can you tell me where I am going wrong please? Sub ad() If Range("sheet1!a1") < 0 Then Range("sheet2!d1").Select Range("sheet2!d1") = Range("sheet1!a1") End If End Sub -- TIM LEE tax agent 55 807 001 4a 123 Colin St West Perth 6005 Tel 08/9481 0337 Fax 9321 0036 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
Hi,
- - - - - - - - - - - - - - - - - - - - - - - - - - Sub ad_old() 'Your macro If Range("Sheet1!A1") < 0 Then Range("Sheet2!D1").Select Range("Sheet2!d1") = Range("Sheet1!a1") End If End Sub Sub ad_new1() If Range("Sheet1!A1") < 0 Then Worksheets("Sheet2").Select Range("D1").Select Range("Sheet2!d1") = Range("Sheet1!a1") End If End Sub Sub ad_new2() If Range("Sheet1!A1").Value < 0 Then Range("Sheet2!D1").Value = Range("Sheet1!A1").Value End If End Sub - - - - - - - - - - - - - - - - - - - - - - - - - - -- Regards, Soo Cheon Jheong _ _ ^ąŻ^ -- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
I am trying to get data in sheet1 a1 (10) into sheet 2 d1 and it wont run -
can you tell me where I am going wrong please? Sub ad() If Range("sheet1!a1") < 0 Then Range("sheet2!d1").Select Range("sheet2!d1") = Range("sheet1!a1") End If End Sub -- TIM LEE tax agent 55 807 001 4a 123 Colin St West Perth 6005 Tel 08/9481 0337 Fax 9321 0036 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
-- TIM LEE tax agent 55 807 001 4a/123 Colin St West Perth 6005 Tel 08 9481 0337 Fax 9321 0036 "Soo Cheon Jheong" wrote in message ... Hi, - - - - - - - - - - - - - - - - - - - - - - - - - - Sub ad_old() 'Your macro If Range("Sheet1!A1") < 0 Then Range("Sheet2!D1").Select Range("Sheet2!d1") = Range("Sheet1!a1") End If End Sub Sub ad_new1() WITH THIS ONE I GET A RUNTIME ERROR 1004 CAN YOU HELP PLEASE? If Range("Sheet1!A1") < 0 Then Worksheets("Sheet2").Select Range("D1").Select Range("Sheet2!d1") = Range("Sheet1!a1") End If End Sub Sub ad_new2() If Range("Sheet1!A1").Value < 0 Then Range("Sheet2!D1").Value = Range("Sheet1!A1").Value End If End Sub - - - - - - - - - - - - - - - - - - - - - - - - - - -- Regards, Soo Cheon Jheong _ _ ^ąŻ^ -- |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
No Dave, I am trying to write a gen ledger program and it needs to be in vba
for other users to use by buttons on menu. I could do what you say but it would be too slow and beyond the scope of the inputters. I understand what you are saying 'keep it simple' -- TIM LEE tax agent 55 807 001 4a/123 Colin St West Perth 6005 Tel 08 9481 0337 Fax 9321 0036 "David McRitchie" wrote in message ... Hi Tim, Are you getting an error? Did you record a macro, you don't need to make a selection, and to process only one cell or even one column doesn't seem to warrent a macro when you can use a worksheet function to keep things up to data instantly. Wouldn't simply putting a formula into Sheet2!d1 suffice? =IF(sheet1!A1=0,,sheet1!A1) --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "timothylee" wrote in message ... I am trying to get data in sheet1 a1 (10) into sheet 2 d1 and it wont run - can you tell me where I am going wrong please? Sub ad() If Range("sheet1!a1") < 0 Then Range("sheet2!d1").Select Range("sheet2!d1") = Range("sheet1!a1") End If End Sub -- TIM LEE tax agent 55 807 001 4a 123 Colin St West Perth 6005 Tel 08/9481 0337 Fax 9321 0036 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
Looks like you were trying to mix syntax.
Sub copyover() If Range("Sheet1!A1") < 0 Then Sheets("sheet2").Range("d1") = Sheets("sheet1").Range("a1") 'or '[sheet2!d1] = [Sheet1!a1] end if End Sub -- Don Guillett SalesAid Software "tim lee" wrote in message ... -- TIM LEE tax agent 55 807 001 4a/123 Colin St West Perth 6005 Tel 08 9481 0337 Fax 9321 0036 "Soo Cheon Jheong" wrote in message ... Hi, - - - - - - - - - - - - - - - - - - - - - - - - - - Sub ad_old() 'Your macro If Range("Sheet1!A1") < 0 Then Range("Sheet2!D1").Select Range("Sheet2!d1") = Range("Sheet1!a1") End If End Sub Sub ad_new1() WITH THIS ONE I GET A RUNTIME ERROR 1004 CAN YOU HELP PLEASE? If Range("Sheet1!A1") < 0 Then Worksheets("Sheet2").Select Range("D1").Select Range("Sheet2!d1") = Range("Sheet1!a1") End If End Sub Sub ad_new2() If Range("Sheet1!A1").Value < 0 Then Range("Sheet2!D1").Value = Range("Sheet1!A1").Value End If End Sub - - - - - - - - - - - - - - - - - - - - - - - - - - -- Regards, Soo Cheon Jheong _ _ ^ąŻ^ -- |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
GETTING DATA ON TO SHEET2
Try copying mine or the other Don's instead of typing it. The syntax is
correct. -- Don Guillett SalesAid Software "tim lee" wrote in message ... When I put this in it comes up in red - syntax error, but I have checked carefully and retyped it twice - any idea what could be wrong - sheets are indeed named sheet1 sheet2 and sheet3. Is that a reserved word [sheets]? I am running mso2000 excel premium vers 9.0.2720 -- TIM LEE tax agent 55 807 001 4a/123 Colin St West Perth 6005 Tel 08 9481 0337 Fax 9321 0036 "Don Lloyd" wrote in message ... Tim, If Sheets("Sheet1").Range("A1")<0 then Sheets("Sheet2").Range("D1")=Sheets("Sheet1").Rang e("A1") End If This should work regardless of which sheet you are on. regards, Don "timothylee" wrote in message ... I am trying to get data in sheet1 a1 (10) into sheet 2 d1 and it wont run - can you tell me where I am going wrong please? Sub ad() If Range("sheet1!a1") < 0 Then Range("sheet2!d1").Select Range("sheet2!d1") = Range("sheet1!a1") End If End Sub -- TIM LEE tax agent 55 807 001 4a 123 Colin St West Perth 6005 Tel 08/9481 0337 Fax 9321 0036 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy data from sheet2 to sheet1 when sheet2 has variable # of rows | Excel Discussion (Misc queries) | |||
macro to print sheet2 without open sheet2 | Excel Discussion (Misc queries) | |||
auto transfer data in sheet2 (selected data) | Excel Worksheet Functions | |||
copying data from sheet1 to sheet2 | Excel Worksheet Functions | |||
enter data in cell which will start macro to move data to sheet2 | Excel Discussion (Misc queries) |