Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default VB Code Question

When running the code below, I'm getting the error 'Name Argument Not Found'
and the 'LookAt:=xlPart' text is highlighted. Any ideas on what I'm doing
wrong?

Sub DateMacro1()

Range("A1:O1").Select
Selection.Replace What: InputBox ("Enter Date"), _
Replacement: InputBox ("Enter Date"), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub

Many thanks if you can help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default VB Code Question

Stan,

You're missing the = symbol after the What and Replacement parameters. You
also don't need to select the range. try it this way

Range("A1:O1").Replace What:=InputBox("Enter Date"), _
Replacement:=InputBox("Enter Date"), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False

--
Hope that helps.

Vergel Adriano


"Stan" wrote:

When running the code below, I'm getting the error 'Name Argument Not Found'
and the 'LookAt:=xlPart' text is highlighted. Any ideas on what I'm doing
wrong?

Sub DateMacro1()

Range("A1:O1").Select
Selection.Replace What: InputBox ("Enter Date"), _
Replacement: InputBox ("Enter Date"), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub

Many thanks if you can help!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default VB Code Question

Many thanks Vergel. That worked perfectly!

"Vergel Adriano" wrote:

Stan,

You're missing the = symbol after the What and Replacement parameters. You
also don't need to select the range. try it this way

Range("A1:O1").Replace What:=InputBox("Enter Date"), _
Replacement:=InputBox("Enter Date"), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False

--
Hope that helps.

Vergel Adriano


"Stan" wrote:

When running the code below, I'm getting the error 'Name Argument Not Found'
and the 'LookAt:=xlPart' text is highlighted. Any ideas on what I'm doing
wrong?

Sub DateMacro1()

Range("A1:O1").Select
Selection.Replace What: InputBox ("Enter Date"), _
Replacement: InputBox ("Enter Date"), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End Sub

Many thanks if you can help!

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
Another code question M&M[_2_] Excel Discussion (Misc queries) 3 August 9th 07 10:00 PM
Code Question kirkm[_6_] Excel Programming 1 February 8th 07 02:19 AM
Code Question Ronbo Excel Programming 3 September 23rd 05 09:33 PM
VBA Code Question Theresa[_4_] Excel Programming 6 October 16th 03 07:06 PM
VBA CODE Question Gary[_5_] Excel Programming 2 July 29th 03 03:45 AM


All times are GMT +1. The time now is 01:08 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"