Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Move Specific Text to new worksheet

I have 2 worksheets in the same workbook, "Sheet 1" and "Sheet 2". From Sheet
2, I need to pull the count from Col H where Col A states, "Account
Employees" and place that number in Cell B12 on Sheet 1. Then I want to copy
the count from Col H where Col A states, "Accounting Exempt" and copy that
count to Cell B13 on Sheet 1. I have about 100 of these counts I need to
copy each day so I'd like to automate it with a macro. Can anybody help me
get started with this, thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Move Specific Text to new worksheet

Sub CopyData()
Dim v as Variant, v1 as Variant
Dim sStr as String, i as Long, rng as Range
v = Array("Account Employees", "Accounting Exempt")
v1 = Array("B12","B13")
for i = lbound(v) to ubound(v)
sStr = v(i)
set rng = Worksheets("Sheet2").Range("A:A").Find(What:=sStr, _
After:=Range("A65536"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Worksheets("Sheet1").Range(v1(i)).Value = _
Worksheets("Sheet2").Range("H" & rng.Row).Value
End If
Next i
End Sub

This is representative. It is specific to the situation you described, but
should show how you can generalize what you need to do. If there is a
pattern in what you are doing, you can program to that pattern. If not, you
might need to list the key information fro each of the hundred counts you
need to process.

--
Regards,
Tom Ogilvy



"glensfallslady" wrote in message
...
I have 2 worksheets in the same workbook, "Sheet 1" and "Sheet 2". From
Sheet
2, I need to pull the count from Col H where Col A states, "Account
Employees" and place that number in Cell B12 on Sheet 1. Then I want to
copy
the count from Col H where Col A states, "Accounting Exempt" and copy that
count to Cell B13 on Sheet 1. I have about 100 of these counts I need to
copy each day so I'd like to automate it with a macro. Can anybody help
me
get started with this, thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Move Specific Text to new worksheet

HI Tom,

I'm sort of following you here but I don't understand what this line is
doing, can you clarify this for me so I'll know for the future.
After:=Range("A65536"), _

Also can I list all +- 100 in one array or would that be too much?

Thanks for your tremendous help.



"Tom Ogilvy" wrote:

Sub CopyData()
Dim v as Variant, v1 as Variant
Dim sStr as String, i as Long, rng as Range
v = Array("Account Employees", "Accounting Exempt")
v1 = Array("B12","B13")
for i = lbound(v) to ubound(v)
sStr = v(i)
set rng = Worksheets("Sheet2").Range("A:A").Find(What:=sStr, _
After:=Range("A65536"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Worksheets("Sheet1").Range(v1(i)).Value = _
Worksheets("Sheet2").Range("H" & rng.Row).Value
End If
Next i
End Sub

This is representative. It is specific to the situation you described, but
should show how you can generalize what you need to do. If there is a
pattern in what you are doing, you can program to that pattern. If not, you
might need to list the key information fro each of the hundred counts you
need to process.

--
Regards,
Tom Ogilvy



"glensfallslady" wrote in message
...
I have 2 worksheets in the same workbook, "Sheet 1" and "Sheet 2". From
Sheet
2, I need to pull the count from Col H where Col A states, "Account
Employees" and place that number in Cell B12 on Sheet 1. Then I want to
copy
the count from Col H where Col A states, "Accounting Exempt" and copy that
count to Cell B13 on Sheet 1. I have about 100 of these counts I need to
copy each day so I'd like to automate it with a macro. Can anybody help
me
get started with this, thanks





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Move Specific Text to new worksheet

Thanks Tom, my report is working great....thanks for your help!

"Tom Ogilvy" wrote:

Sub CopyData()
Dim v as Variant, v1 as Variant
Dim sStr as String, i as Long, rng as Range
v = Array("Account Employees", "Accounting Exempt")
v1 = Array("B12","B13")
for i = lbound(v) to ubound(v)
sStr = v(i)
set rng = Worksheets("Sheet2").Range("A:A").Find(What:=sStr, _
After:=Range("A65536"), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Worksheets("Sheet1").Range(v1(i)).Value = _
Worksheets("Sheet2").Range("H" & rng.Row).Value
End If
Next i
End Sub

This is representative. It is specific to the situation you described, but
should show how you can generalize what you need to do. If there is a
pattern in what you are doing, you can program to that pattern. If not, you
might need to list the key information fro each of the hundred counts you
need to process.

--
Regards,
Tom Ogilvy



"glensfallslady" wrote in message
...
I have 2 worksheets in the same workbook, "Sheet 1" and "Sheet 2". From
Sheet
2, I need to pull the count from Col H where Col A states, "Account
Employees" and place that number in Cell B12 on Sheet 1. Then I want to
copy
the count from Col H where Col A states, "Accounting Exempt" and copy that
count to Cell B13 on Sheet 1. I have about 100 of these counts I need to
copy each day so I'd like to automate it with a macro. Can anybody help
me
get started with this, thanks





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
Text boxes move on protected worksheet Jwh Excel Discussion (Misc queries) 3 March 2nd 10 03:33 PM
Macro to Move Specific Data to Another Worksheet jeannie v Excel Worksheet Functions 1 January 20th 08 06:30 PM
Move Specific Data to Another Worksheet jeannie v Excel Worksheet Functions 3 January 19th 08 10:08 PM
Move text that is a specific color to a different cell Alison84 Excel Worksheet Functions 3 November 15th 06 04:12 PM
Move to a specific cell JT[_2_] Excel Programming 1 July 30th 04 03:54 PM


All times are GMT +1. The time now is 05:39 AM.

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"