![]() |
Inserting data into a different worksheet
Hello, I have a VBA form that a user completes to add data. When the form is closed, I can transfer the data into the current worksheet by this.... Code: -------------------- Range("h" & TankLine).Value = txtDate.Text Range("i" & TankLine).Value = txtTime.Text Range("g" & TankLine).Value = txtInits.Text -------------------- but I can't get it to put data into a different worksheet in the same workbook. I have tried Code: -------------------- Sheet1.Range("h" & TankLine).Value = txtDate.Text -------------------- and Code: -------------------- Sheet1!Range("h" & TankLine).Value = txtDate.Text -------------------- but neither works. How do I do this, please? Thanks, Richard -- rickalty ------------------------------------------------------------------------ rickalty's Profile: http://www.excelforum.com/member.php...o&userid=34180 View this thread: http://www.excelforum.com/showthread...hreadid=539426 |
Inserting data into a different worksheet
Try
Worksheets("Sheet2").Range("h"&TankLine).Value = txtDate.Text -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "rickalty" wrote in message ... Hello, I have a VBA form that a user completes to add data. When the form is closed, I can transfer the data into the current worksheet by this.... Code: -------------------- Range("h" & TankLine).Value = txtDate.Text Range("i" & TankLine).Value = txtTime.Text Range("g" & TankLine).Value = txtInits.Text -------------------- but I can't get it to put data into a different worksheet in the same workbook. I have tried Code: -------------------- Sheet1.Range("h" & TankLine).Value = txtDate.Text -------------------- and Code: -------------------- Sheet1!Range("h" & TankLine).Value = txtDate.Text -------------------- but neither works. How do I do this, please? Thanks, Richard -- rickalty ------------------------------------------------------------------------ rickalty's Profile: http://www.excelforum.com/member.php...o&userid=34180 View this thread: http://www.excelforum.com/showthread...hreadid=539426 |
Inserting data into a different worksheet
Thank you! That worked perfectly. Richard -- rickalty ------------------------------------------------------------------------ rickalty's Profile: http://www.excelforum.com/member.php...o&userid=34180 View this thread: http://www.excelforum.com/showthread...hreadid=539426 |
All times are GMT +1. The time now is 04:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com