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


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


.



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


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
how to sheet1 data goes to sheet2 automaticaly ? ABDUSSALAM Excel Worksheet Functions 2 March 10th 10 04:12 PM
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
A1 Sheet2 is linked to A1 sheet1 so that user enters value(abc123) a1 sheet1 and A1 sheet2 is updated pano[_3_] Excel Programming 2 October 28th 07 02:32 PM
copying data from sheet1 to sheet2 Rookie Excel Worksheet Functions 3 September 7th 06 12:09 PM
How To Retrieve Data from Sheet2 into Sheet1 compconnj Excel Worksheet Functions 3 March 21st 06 07:56 PM


All times are GMT +1. The time now is 05:49 PM.

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

About Us

"It's about Microsoft Excel"