Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default GETTING DATA ON TO SHEET2

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






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
macro to print sheet2 without open sheet2 ramzi Excel Discussion (Misc queries) 1 January 28th 09 12:07 PM
auto transfer data in sheet2 (selected data) deen Excel Worksheet Functions 1 May 9th 08 01:57 PM
copying data from sheet1 to sheet2 Rookie Excel Worksheet Functions 3 September 7th 06 12:09 PM
enter data in cell which will start macro to move data to sheet2 Tommy Excel Discussion (Misc queries) 0 May 12th 05 05:00 PM


All times are GMT +1. The time now is 09:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"