![]() |
Referencing worksheets
I am trying to figure out a way to reference a value from one sheet to another. I know how to go to sheet 2 and "receive" a value from sheet 1 (=sheet1!a1), but I don't know how to take a value from sheet1 and "send" it to sheet 2 (??). Also, say I have a workbook with one worksheet in it titled "RED". Is there a way for me to say if there is a value in cell b2 on worksheet "RED" for Excel to automatically create a new workskeet and title it "BLUE"? One more thing. Regardless of whether both of these can be done separately, is there a way to do them simultaneously? -- NewExcelGuy ------------------------------------------------------------------------ NewExcelGuy's Profile: http://www.excelforum.com/member.php...o&userid=27141 View this thread: http://www.excelforum.com/showthread...hreadid=466567 |
Copy code below
Alt-F11 to open the VBA editor Insert module from the menubar Paste the sub Alt-Q to go back to excel Alt-F8 Select test Run ' Sub starts here Sub test() Sheets("red").Select If Range("b2") = "something" Then Worksheets.Add.Name = "Blue" ActiveSheet.Range("a1") = Sheets("red").Range("b2") Sheets("red").Select End Sub I hope this helps "NewExcelGuy" wrote in message ... I am trying to figure out a way to reference a value from one sheet to another. I know how to go to sheet 2 and "receive" a value from sheet 1 (=sheet1!a1), but I don't know how to take a value from sheet1 and "send" it to sheet 2 (??). Also, say I have a workbook with one worksheet in it titled "RED". Is there a way for me to say if there is a value in cell b2 on worksheet "RED" for Excel to automatically create a new workskeet and title it "BLUE"? One more thing. Regardless of whether both of these can be done separately, is there a way to do them simultaneously? -- NewExcelGuy ------------------------------------------------------------------------ NewExcelGuy's Profile: http://www.excelforum.com/member.php...o&userid=27141 View this thread: http://www.excelforum.com/showthread...hreadid=466567 |
Actually, this would be better:
Sub test() Sheets("red").Select If Range("b2") = "something" Then Worksheets.Add.Name = "Blue" ActiveSheet.Range("a1") = Sheets("red").Range("b2") Else End If Sheets("red").Select End Sub "Don" wrote in message ... Copy code below Alt-F11 to open the VBA editor Insert module from the menubar Paste the sub Alt-Q to go back to excel Alt-F8 Select test Run ' Sub starts here Sub test() Sheets("red").Select If Range("b2") = "something" Then Worksheets.Add.Name = "Blue" ActiveSheet.Range("a1") = Sheets("red").Range("b2") Sheets("red").Select End Sub I hope this helps "NewExcelGuy" wrote in message ... I am trying to figure out a way to reference a value from one sheet to another. I know how to go to sheet 2 and "receive" a value from sheet 1 (=sheet1!a1), but I don't know how to take a value from sheet1 and "send" it to sheet 2 (??). Also, say I have a workbook with one worksheet in it titled "RED". Is there a way for me to say if there is a value in cell b2 on worksheet "RED" for Excel to automatically create a new workskeet and title it "BLUE"? One more thing. Regardless of whether both of these can be done separately, is there a way to do them simultaneously? -- NewExcelGuy ------------------------------------------------------------------------ NewExcelGuy's Profile: http://www.excelforum.com/member.php...o&userid=27141 View this thread: http://www.excelforum.com/showthread...hreadid=466567 |
All times are GMT +1. The time now is 06:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com