![]() |
Working in Sheet2 with data from Sheet1
I am working in Sheet2. The data is in Sheet1. I can not get the data in
column in the 15th column to initalize the "If" even if Textbox1.Text matches. For k= 1 to 100 If Sheets("Sheet1").Cells(k,15)=TextBox1.Text Then code... End if Next k |
Working in Sheet2 with data from Sheet1
I tried:
If Sheets("Sheet1").Cells(k,15)=Sheets("Sheet2").Text Box1.Text Then With Sheets("Sheet2") If Sheets("Sheet1").Cells(k,15)=.TextBox1.Text Then .... End With If Sheets("Sheet1").Cells(k,15)=TextBox1.Text Then Nothing worked. |
Working in Sheet2 with data from Sheet1
Philosophaie wrote :
I am working in Sheet2. The data is in Sheet1. I can not get the data in column in the 15th column to initalize the "If" even if Textbox1.Text matches. For k= 1 to 100 If Sheets("Sheet1").Cells(k,15)=TextBox1.Text Then code... End if Next k Lots of possibilities here! What is in Cells(k, 15)? Have you tried specifying Cells(k, 15).Text since your evaluating it against text stored in the textbox? We need more info in order to know how to better help you! regards, -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Working in Sheet2 with data from Sheet1
I'd add the property:
If Sheets("Sheet1").Cells(k,15).value = Sheets("Sheet2").TextBox1.Text Then And maybe it's an upper/lower case difference: if lcase(Sheets("Sheet1").Cells(k,15).value) _ = lcase(Sheets("Sheet2").TextBox1.Text) Then If these don't help, I think you should try adding a msgbox before the line: msgbox "***" & Sheets("Sheet1").Cells(k,15).value & "***" _ & "***" & sheets("sheet2").textbox1.text & "***" To see if you can spot the difference. Philosophaie wrote: I tried: If Sheets("Sheet1").Cells(k,15)=Sheets("Sheet2").Text Box1.Text Then With Sheets("Sheet2") If Sheets("Sheet1").Cells(k,15)=.TextBox1.Text Then ... End With If Sheets("Sheet1").Cells(k,15)=TextBox1.Text Then Nothing worked. -- Dave Peterson |
Working in Sheet2 with data from Sheet1
Already tried Cells(k,15).Text and .Value they did not work. I purposefully
put a number in the Textbox that exists many times in "Sheet1" row 15. Lots of possibilities here! What is in Cells(k, 15)? Have you tried specifying Cells(k, 15).Text since your evaluating it against text stored in the textbox? We need more info in order to know how to better help you! regards, -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc . |
Working in Sheet2 with data from Sheet1
Philosophaie has brought this to us :
Already tried Cells(k,15).Text and .Value they did not work. I purposefully put a number in the Textbox that exists many times in "Sheet1" row 15. Lots of possibilities here! What is in Cells(k, 15)? Have you tried specifying Cells(k, 15).Text since your evaluating it against text stored in the textbox? We need more info in order to know how to better help you! regards, -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc . Your code snippets work for me so I suspect that 'Not Cells(k, 15) = TextBox1.Text' is the case. Did you check for that? I ask because I don't see an 'Else' clause in your If construct. If for any reason VBA determines it's not equal then you'll have something to work with beyond just trying to figure out why '=' doesn't work. HTH -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
All times are GMT +1. The time now is 10:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com