#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 361
Default Macro Prob

I am experimenting and trying to learn how the code works. I have the code
below. It gets hung on S = "=" & Range(i).Value.

I am trying to have the program take the value in G6 and set that value to
S. Then loop back and take the next value G7 and set that to S.

For i = 6 To 7
Range("G" & i).Select

Dim S As String
S = "=" & Range(i).Value



Selection.Copy
Sheets("TMS").Select
Selection.AutoFilter Field:=1, Criteria1:=S, Operator:=xlAnd
Range("F1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("CheckNamesSent").Select
Range("I4").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Next i
End Sub


What am I doing wrong ?

Thank you in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 510
Default Macro Prob

Hi carl,

Just replace
For i = 6 To 7
Range("G" & i).Select
Dim S As String
S = "=" & Range(i).Value
Selection.Copy

By

For i = 6 To 7
Range("G" & i).Copy



HTH
Cheers
Carim

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 459
Default Macro Prob

carl wrote:
I am experimenting and trying to learn how the code works. I have the
code below. It gets hung on S = "=" & Range(i).Value.

[cut]

If (but not sure...) I well understand, you should solve this way:

S = Range(i).Value

or if you want concatenate the values in G6 and G7

S = S & Range(i).Value

--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 65
Default Macro Prob

Your statement says to use Range(i).value. "i" is only a number this
point. I'm assuming you want:
S = "=" & Range("G" & i).Value

"carl" wrote in message
...
I am experimenting and trying to learn how the code works. I have the code
below. It gets hung on S = "=" & Range(i).Value.

I am trying to have the program take the value in G6 and set that value to
S. Then loop back and take the next value G7 and set that to S.

For i = 6 To 7
Range("G" & i).Select

Dim S As String
S = "=" & Range(i).Value



Selection.Copy
Sheets("TMS").Select
Selection.AutoFilter Field:=1, Criteria1:=S, Operator:=xlAnd
Range("F1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("CheckNamesSent").Select
Range("I4").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
_
False, Transpose:=False

Next i
End Sub


What am I doing wrong ?

Thank you in advance.



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
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM


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