Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding input to macro


I posted this yesterday but didn't get an answer so here it is again:

ok just to restate my next question. I am using this code for the
current date:

Sub placeDate()
Dim rng as Range
set rng = cells(rows.count,"A").End(xlup)
if not isempty(rng) then
' check that it isn't already there
if rng.value = date then exit sub
' it isn't the current date, so place today's
' date in the next cell
set rng = rng.offset(1,0)
end if

rng.Value = Date
End Sub


Now I want to ask the user what value to input into column E of the
same row as the current date. Can I add that easily in now? And how?


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile: http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482267

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Adding input to macro

You can use the InputBox() function to get input from the user.

cappuccine wrote:
I posted this yesterday but didn't get an answer so here it is again:

ok just to restate my next question. I am using this code for the
current date:

Sub placeDate()
Dim rng as Range
set rng = cells(rows.count,"A").End(xlup)
if not isempty(rng) then
' check that it isn't already there
if rng.value = date then exit sub
' it isn't the current date, so place today's
' date in the next cell
set rng = rng.offset(1,0)
end if

rng.Value = Date
End Sub


Now I want to ask the user what value to input into column E of the
same row as the current date. Can I add that easily in now? And how?


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile: http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482267


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding input to macro


ok how do I use that? And how do I input that value into column E in the
same row that the previous macro found as an open space to put the date
in?


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile: http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482267

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Adding input to macro

rng.Value = Date
rng.offset(0,4).value = InputBox("Supply value please")
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"cappuccine" wrote
in message ...

I posted this yesterday but didn't get an answer so here it is again:

ok just to restate my next question. I am using this code for the
current date:

Sub placeDate()
Dim rng as Range
set rng = cells(rows.count,"A").End(xlup)
if not isempty(rng) then
' check that it isn't already there
if rng.value = date then exit sub
' it isn't the current date, so place today's
' date in the next cell
set rng = rng.offset(1,0)
end if

rng.Value = Date
End Sub


Now I want to ask the user what value to input into column E of the
same row as the current date. Can I add that easily in now? And how?


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile:

http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482267



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding input to macro


awesome.. ok, another question. Now that I have the value from the input
box, I want to repeat the code again to do the same thing on a different
sheet. I changed rng to rng1 so I don't get a duplicate error. How do I
use the value from the input box again without having to ask for it
again?


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile: http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482267



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Adding input to macro

rng.Value = Date
myVal = InputBox("Supply value please")
rng.offset(0,4).value = myVal
' the other code
rng1.offset(0,4).value = myVal
End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)


"cappuccine" wrote
in message ...

awesome.. ok, another question. Now that I have the value from the input
box, I want to repeat the code again to do the same thing on a different
sheet. I changed rng to rng1 so I don't get a duplicate error. How do I
use the value from the input box again without having to ask for it
again?


--
cappuccine
------------------------------------------------------------------------
cappuccine's Profile:

http://www.excelforum.com/member.php...o&userid=28242
View this thread: http://www.excelforum.com/showthread...hreadid=482267



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
Auto-adding text when a certain number is input Lauren Excel Worksheet Functions 1 June 25th 09 06:24 AM
Adding up within a cell during data input purelycreativeadam Excel Discussion (Misc queries) 3 October 27th 08 05:25 PM
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 05:23 AM
Having problems with adding input from combobox stevem[_5_] Excel Programming 1 April 2nd 04 03:44 AM
adding sheets based on input david Excel Programming 1 July 25th 03 06:17 PM


All times are GMT +1. The time now is 04:51 PM.

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"