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

My macro pulls info from another file (2.txt)

When the file is generated, i have no control of the placement o
certain cells. But what i do have is a constant that the word BANK i
always in column E (regardles off the row) and cell i need is directl
after the word bank in column F. I need to copy the cell that's in
(thats directly to the right after the word Bank) and paste it into m
sheet101 worksheet in cell AL2.

Can anyone help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Cell Question

H

The following should get you started. It does assume that sheet101 is in the same workbook as the source data and this will have to be changed

Ton

Sub aaa(

Set finder = Range("e:e").Find(what:="BANK"

If Not finder Is Nothing The
Range("e:e").Find(what:="BANK").Activat
Sheets("sheet101").Range("a2").Value = ActiveCell.Offset(0, 1).Valu
End I

End Su

----- alexm999 wrote: ----

My macro pulls info from another file (2.txt

When the file is generated, i have no control of the placement o
certain cells. But what i do have is a constant that the word BANK i
always in column E (regardles off the row) and cell i need is directl
after the word bank in column F. I need to copy the cell that's in
(thats directly to the right after the word Bank) and paste it into m
sheet101 worksheet in cell AL2

Can anyone help


--
Message posted from http://www.ExcelForum.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Cell Question

Alex

One way:

Sub CopyCell()

Dim RequiredBankCell As Range
Set RequiredBankCell = _
Columns("E:E").Find(What:="BANK", _
After:=Range("E1"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
With Sheets("Sheet101")
RequiredBankCell.Offset(0, 1).Copy .Range("AL2")
End With

End Sub


Regards

Trevor


"alexm999 " wrote in message
...
My macro pulls info from another file (2.txt)

When the file is generated, i have no control of the placement of
certain cells. But what i do have is a constant that the word BANK is
always in column E (regardles off the row) and cell i need is directly
after the word bank in column F. I need to copy the cell that's in F
(thats directly to the right after the word Bank) and paste it into my
sheet101 worksheet in cell AL2.

Can anyone help?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Question

OK, im almost there...
My worksheets will change on a monthly basis...

Instead of sheet101 as the worksheet. How do I make it point t
"activeworksheet" so it doesnt matter what i call the worksheet nex
month...

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Question

Im trying to get the code you wrote to copy the cell directly to the
right of the word BANK and paste it to AL3 in the DAILY
OPERATIONS_2004.xls file, but it's not working... Any help? Getting
errors


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Question

Here's the text file to give you a better idea of the dilemma...

The file is already opened and cells are being copied and pasted to th
other workbook. It's just the BANK problem thats all the way at th
bottom the spreadsheet.
Again, the row for the Cash to Bank and Cash from Bank information ca
change on a daily basis...
I just need the numbers from next to the work BAN

--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cell Question

The code ran fine for me. No errors.

Go back to the original code.

this modification copies the cell to workbook Daily Operations_2004.xls
(assuming you spelled it correctly) to sheet101 in that workbook to cell
AL2.

Sub CopyCell()
Dim wkbk as Workbook

Dim RequiredBankCell As Range

set wkbk = Workbooks("DAILY OPERATIONS_2004.xls")
Set RequiredBankCell = _
Columns("E:E").Find(What:="BANK", _
After:=Range("E1"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
With wkbk.Sheets("Sheet101")
RequiredBankCell.Offset(0, 1).Copy .Range("AL2")
End With

End Sub

--
Regards,
Tom Ogilvy



"alexm999 " wrote in message
...
Im trying to get the code you wrote to copy the cell directly to the
right of the word BANK and paste it to AL3 in the DAILY
OPERATIONS_2004.xls file, but it's not working... Any help? Getting
errors


---
Message posted from http://www.ExcelForum.com/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Cell Question

There are 2 files I'm working with...
3.TXT and DAILY OPERATIONS_2004.xls

I need the data directly in the cell to the right of the word BANK fro
3.txt and have it pasted to the Daily Operations_2004.xls file cel
AL1

--
Message posted from http://www.ExcelForum.com

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cell Question

Apparently you don't understand the code.

The activesheet is used to look for the word BANK, so if you don't want the
value in column F next to BANK pasted in cell AL2 of that same sheet, you
will have to specify where you do want it pasted - activesheet won't cut it
here.

--
Regards,
Tom Ogilvy

"alexm999 " wrote in message
...
OK, im almost there...
My worksheets will change on a monthly basis...

Instead of sheet101 as the worksheet. How do I make it point to
"activeworksheet" so it doesnt matter what i call the worksheet next
month...?


---
Message posted from http://www.ExcelForum.com/



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
Conditional Formatting question (if cell = 0, wrap cell in quotes) Mo2 New Users to Excel 6 May 11th 07 11:06 PM
Cell question Steve Excel Worksheet Functions 2 July 4th 06 09:53 AM
Cell question hapster Excel Programming 1 December 12th 03 06:22 PM
Question in a function cell to cell keawee Excel Programming 2 September 30th 03 02:25 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


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