Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default putting info from one file into another using vba

I am using vba in spreadsheet1 to open and count data from an excel
spreadsheet located online (spreadsheet2). Once that data is counted in
spreadsheet2, I want that value to be printed in spreadsheet1 where the macro
was initially run from. I have the following code so far, but it will
(obviously) print the data in spreadsheet2 rather than spreadsheet1:

Sub openn()
Dim Countt As Long
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) +
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

Range("k53").Value = Countt

End Sub

How do I get it to put that value in spreadsheet1?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default putting info from one file into another using vba

Sub openn()
Dim Countt As Long
Dim sh as worksheet

set sh = Activesheet
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) +
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

sh.Range("k53").Value = Countt

End Sub

--
Regards,
Tom Ogilvy


"Jayne22" wrote:

I am using vba in spreadsheet1 to open and count data from an excel
spreadsheet located online (spreadsheet2). Once that data is counted in
spreadsheet2, I want that value to be printed in spreadsheet1 where the macro
was initially run from. I have the following code so far, but it will
(obviously) print the data in spreadsheet2 rather than spreadsheet1:

Sub openn()
Dim Countt As Long
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) +
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

Range("k53").Value = Countt

End Sub

How do I get it to put that value in spreadsheet1?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 245
Default putting info from one file into another using vba

Try using this

http://www.rondebruin.nl/copy7.htm

"Jayne22" wrote:

I am using vba in spreadsheet1 to open and count data from an excel
spreadsheet located online (spreadsheet2). Once that data is counted in
spreadsheet2, I want that value to be printed in spreadsheet1 where the macro
was initially run from. I have the following code so far, but it will
(obviously) print the data in spreadsheet2 rather than spreadsheet1:

Sub openn()
Dim Countt As Long
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) +
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

Range("k53").Value = Countt

End Sub

How do I get it to put that value in spreadsheet1?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default putting info from one file into another using vba

wow, thanks for your help! This site has been an excellent way to get my
questions answered since I am new to VBA.

"Tom Ogilvy" wrote:

Sub openn()
Dim Countt As Long
Dim sh as worksheet

set sh = Activesheet
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) +
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

sh.Range("k53").Value = Countt

End Sub

--
Regards,
Tom Ogilvy


"Jayne22" wrote:

I am using vba in spreadsheet1 to open and count data from an excel
spreadsheet located online (spreadsheet2). Once that data is counted in
spreadsheet2, I want that value to be printed in spreadsheet1 where the macro
was initially run from. I have the following code so far, but it will
(obviously) print the data in spreadsheet2 rather than spreadsheet1:

Sub openn()
Dim Countt As Long
Workbooks.Open Filename:="sample filename.xls"

Countt = CountColor(Range("D4:GE4"), 45, False) +
CountColor(Range("D4:GE4"), 10, False) + CountColor(Range("d4:GE4"), 8, False)

Range("k53").Value = Countt

End Sub

How do I get it to put that value in spreadsheet1?

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
Need help taking columns of info and putting them into another fil ZBelden Excel Discussion (Misc queries) 0 February 8th 08 05:04 PM
Pulling info 2 cells and putting it in one Ian Excel Worksheet Functions 3 September 14th 07 07:24 PM
Putting Excel formatting and/or formulas into CSV file Frank D. Nicodem, Jr. Excel Discussion (Misc queries) 1 July 11th 05 10:18 PM
Putting Data & Time in file name rglasunow[_24_] Excel Programming 3 July 8th 05 07:51 PM
putting file name within spreadsheet bobf Excel Discussion (Misc queries) 3 April 1st 05 04:39 PM


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