Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default problem w/ vb -control

Please Help!

I have a textbox where a user can type a date and a calculate button
user can press to look at all sheets in workbook and if the date in th
textbox matches a date in a cell on a worksheet then it copies tex
from the sheet and pastes it in another location.

My problem is, I cannot make my vba recognize that the date in th
textbox matches the date in the cell (even when they do)

Thanks in advance for your help!

My code is below:

Private Sub CalculateButton_Click()
For i = 3 To Sheets.Count
Sheets(i).Select
If ActiveSheet.Range("b1") = DateUpdateTextBox.Value Then
ActiveSheet.Range("b18:c18").Copy
ActiveWorkbook.Sheets("Rollup").Activate
ActiveWorkbook.Sheets("Rollup").Unprotect
Range("f2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.PasteSpecial xlPasteValues
Else
End If
Next
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default problem w/ vb -control

The problem is that the vba doesnt care about if you can
make it match.

Do you work for a circus by the way!

Roll Up Roll Up


-----Original Message-----
Please Help!

I have a textbox where a user can type a date and a

calculate button a
user can press to look at all sheets in workbook and if

the date in the
textbox matches a date in a cell on a worksheet then it

copies text
from the sheet and pastes it in another location.

My problem is, I cannot make my vba recognize that the

date in the
textbox matches the date in the cell (even when they do)

Thanks in advance for your help!

My code is below:

Private Sub CalculateButton_Click()
For i = 3 To Sheets.Count
Sheets(i).Select
If ActiveSheet.Range("b1") = DateUpdateTextBox.Value Then
ActiveSheet.Range("b18:c18").Copy
ActiveWorkbook.Sheets("Rollup").Activate
ActiveWorkbook.Sheets("Rollup").Unprotect
Range("f2").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.PasteSpecial xlPasteValues
Else
End If
Next
End Sub


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default problem w/ vb -control

Try using the Format and CvDate functions in conjunction so your comparing apples to apple

Dim dt1 as Date dt2 as Dat
dt1 = Format(CvDate(ActiveSheet.Range("b1")), "mmddyyyy")
dt2 = Format(CvDate(DateUpdateTextBox.Value ), "mmddyyyy")
If dt1= dt2 The
You might want to do an IsDate test first also



----- Adresmith wrote: ----

Please Help

I have a textbox where a user can type a date and a calculate button
user can press to look at all sheets in workbook and if the date in th
textbox matches a date in a cell on a worksheet then it copies tex
from the sheet and pastes it in another location

My problem is, I cannot make my vba recognize that the date in th
textbox matches the date in the cell (even when they do

Thanks in advance for your help

My code is below

Private Sub CalculateButton_Click(
For i = 3 To Sheets.Coun
Sheets(i).Selec
If ActiveSheet.Range("b1") = DateUpdateTextBox.Value The
ActiveSheet.Range("b18:c18").Cop
ActiveWorkbook.Sheets("Rollup").Activat
ActiveWorkbook.Sheets("Rollup").Unprotec
Range("f2").Selec
D
If IsEmpty(ActiveCell) = False The
ActiveCell.Offset(1, 0).Selec
End I
Loop Until IsEmpty(ActiveCell) = Tru
ActiveCell.PasteSpecial xlPasteValue
Els
End I
Nex
End Su


--
Message posted from http://www.ExcelForum.com


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
Problem with control tag and populating speadsheet antonsaitz Excel Discussion (Misc queries) 0 June 30th 06 04:29 PM
problem with checkbox control Giselle Excel Worksheet Functions 1 March 31st 06 12:57 PM
Control sizing problem Jim McLeod Excel Programming 2 April 17th 04 06:11 PM
Repost- problem with calender control Tim Excel Programming 4 February 20th 04 06:49 PM
problem with calender control Tim Excel Programming 3 February 20th 04 03:55 PM


All times are GMT +1. The time now is 03:07 AM.

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"