View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Carlee Carlee is offline
external usenet poster
 
Posts: 155
Default Copy / Paste Specifc Row based on Input Box Value

Hi there,

1. my date format is as follows: 15/03/2007
2. I would like the user to be able to click a button on the 'Report
Options' form; however, it appears that this code will only work if the
worksheet is active. Can this be changes?

Many thanks in advance,
--
Carlee


"JLGWhiz" wrote:

If your date format in column B is not m/d/yyyy then the code will fail. You
will need to change this line in the code I gave you:

myDate = Format(myDate, "m/d/yyyy")

To reflect the date format that you are using. If you have a problem, just
post a sample of the date format you are using and I will give you a new line
to replace this one.

"Carlee" wrote:

Hi
My date column is column B, so I changed the code to the following, but
nothing is happening. Worksheet 1 = 'Daily Reading Master Log' and Worksheet
2 = 'Customer1 Daily'. What am I doing wrong?

lastRow = Cells(Rows.Count, 1).End(xlUp).Row
myDate = InputBox("Enter a date", "User Date")
myDate = Format(myDate, "m/d/yyyy")
With Worksheets("Daily Reading Master Log").Range("$B$1:B" & lastRow)
Set c = .Find(myDate, After:=Range("B" & lastRow), LookIn:=xlValues)
If Not c Is Nothing Then
pRng = c.Address
.Range(pRng).EntireRow.Copy Worksheets("Customer1
Daily").Range("$A$50")
End If
End With

--
Carlee


"JLGWhiz" wrote:

Assuming the dates are in Column A of sheet one and sheet one is the active
sheet:

Sub cpynPst()
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
myDate = InputBox("Enter a date", "User Date")
myDate = Format(myDate, "m/d/yyyy")
With Worksheets(1).Range("$A$1:A" & lastRow)
Set c = .Find(myDate, After:=Range("A" & lastRow), LookIn:=xlValues)
If Not c Is Nothing Then
pRng = c.Address
.Range(pRng).EntireRow.Copy Worksheets(2).Range("$A$50")
End If
End With
End Sub

The only problem with this, Carlee, is that the user must use conventional
date formats for it to be converted to the default m/d/yyyy format.

"Carlee" wrote:

Hi there,

I would like to copy and paste a specific row from Sheet 1, to row 50 of
Sheet 2, based on a date provided by the user in an input box. Each date
represents a specific row in Sheet 1.

Can any one help me?
--
Carlee