View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Simple Excel macro

sub addtoclipboard()
Dim rng as Range
for each cell in Range("G5:G100")
if cell.value = 1 then
if rng is nothing then
set rng = cell
else
set rng = union(rng,cell)
end if
end if
Next
if not rng is nothing then
set rng = Intersect(rng.entireRow,Columns(3))
rng.select
rng.copy
else
msgbox "Nothing to copy"
end if
End Sub

Just remember that there are many actions that will clear the clipboard

--
Regards,
Tom Ogilvy


"madbunny" wrote:


If anyone can help me with this problem I'd appreciate it.
I'm trying to make what I'd assume is a simple excel macro but I cannot
find any useful FAQs or website with actual useful help on making excel
macros.

Basically I want to select a column, let's call it column G, and I want
the macro to check every field in that column from say 5 to 100 and if
there's a 1 in that field, then get the information in column C in the
same row, and put it into the windows clipboard so I can paste it
later.

I'm using Selection.Cells(x,1).value in a loop and incrementing x to
find the value in the selected column, but how do I then select column
C in the same row if it's a 1? Also I'm unsure how to add this
information to windows clipboard. I want to be able to ctrl-V once I've
run the macro and simple paste the list of information that was
retrieved.

If anyone can help me with this or simply point me to a useful online
resource I'd appreciate it.


--
madbunny
------------------------------------------------------------------------
madbunny's Profile: http://www.excelforum.com/member.php...o&userid=32541
View this thread: http://www.excelforum.com/showthread...hreadid=523253