paste is too fast

A

alien___alien

I have a problem where my paste command is getting done before my
instruction to move to the next cell. Causing my value to get put into
my first box instead of the second, then it moves to the next box.

It's supposed to (select sheet "0", select a cell specified cell, move
down "MyValue". Then go to the "Entry" sheet, copy a specified cell,
return to sheet "0" and paste the value into the newly selected cell)

------ Here's the code ---

Public MyValue As Integer
----------------------------------

Sub Macro2()

Dim Message, Title, Default, MyValue
Message = "Enter the Day you are working on." ' Set prompt.
Title = "Current Day" ' Set title.
Default = "" ' Set default.


MyValue = InputBox(Message, Title, Default)
Sheets("0").Select
Application.Goto Reference:="R4C22"
ActiveCell.Select
Application.SendKeys "{DOWN " + MyValue + "}"

Sheets("Entry").Select
Range("G89").Select
Selection.Copy

Sheets("0").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
 
D

Debra Dalgleish

It's best to avoid using SendKeys. The following code uses the Offset
property to paste the data the specified number of rows below the
starting cell on Sheet0:

MyValue = InputBox(Message, Title, Default)

Sheets("Entry").Select
Range("G89").Copy
Sheets("0").Select
Range("V4").Offset(MyValue, 0).PasteSpecial _
Paste:=xlPasteValues
 
D

Don Guillett

How about this? No selecting. No copying. No pasting.

sub getrngvalue()
MyValue = InputBox(Message, Title, Default)
sheets("O").range("v4").offset(myvalue)=Sheets("Entry").Range("G89")
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top