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

I totally screwed up...I posted this in the Access group. Anyway, I usually
find what I need but not this time...

I would like to run a macro based on a column. Example, if A7:A5000, then
copy F7:F500. Basically, if A7 is 0, I would like F7 to be copied and paste
in BB7, and for it to go down to 500.

Thanks in advance
Cheers
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Macro If Then Question

Hi mslabbe -

Here's one way:

Sub mslabbe()
For Each cel In Range("A1:A500")
If cel.Value 0 Then cel.Offset(0, 53) = _
cel.Offset(0, 5)
Next 'cel
End Sub

----
Jay



"mslabbe" wrote:

I totally screwed up...I posted this in the Access group. Anyway, I usually
find what I need but not this time...

I would like to run a macro based on a column. Example, if A7:A5000, then
copy F7:F500. Basically, if A7 is 0, I would like F7 to be copied and paste
in BB7, and for it to go down to 500.

Thanks in advance
Cheers

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Macro If Then Question

Jay...that works well...thanks!

"Jay" wrote:

Hi mslabbe -

Here's one way:

Sub mslabbe()
For Each cel In Range("A1:A500")
If cel.Value 0 Then cel.Offset(0, 53) = _
cel.Offset(0, 5)
Next 'cel
End Sub

----
Jay



"mslabbe" wrote:

I totally screwed up...I posted this in the Access group. Anyway, I usually
find what I need but not this time...

I would like to run a macro based on a column. Example, if A7:A5000, then
copy F7:F500. Basically, if A7 is 0, I would like F7 to be copied and paste
in BB7, and for it to go down to 500.

Thanks in advance
Cheers

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Macro If Then Question

Is there slick way to have it go to a different tab and start in a different
cell INSTEAD of going to column BB? So If A1:A5000 Then F1:F500 copy and
paste into worksheet 'sheet3' B10:B510.



"Jay" wrote:

Hi mslabbe -

Here's one way:

Sub mslabbe()
For Each cel In Range("A1:A500")
If cel.Value 0 Then cel.Offset(0, 53) = _
cel.Offset(0, 5)
Next 'cel
End Sub

----
Jay



"mslabbe" wrote:

I totally screwed up...I posted this in the Access group. Anyway, I usually
find what I need but not this time...

I would like to run a macro based on a column. Example, if A7:A5000, then
copy F7:F500. Basically, if A7 is 0, I would like F7 to be copied and paste
in BB7, and for it to go down to 500.

Thanks in advance
Cheers

  #5   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Macro If Then Question

Hi mslabbe -

Adjust the statements in the 'User-defined parameters' section to suit.

Sub mslabbe_V2()
'------------------------
'User-defined parameters
'------------------------
sSheet = "source_sheet_name_here"
dSheet = "destination_sheet_name_here"
dCol = "B": dRow = 10 'output col and 1st output row
'------------------------
Set ws1 = Worksheets(sSheet)
Set ws2 = Worksheets(dSheet)

For Each cel In ws1.Range("A1:A500")
If cel.Value 0 Then
ws2.Range(dCol & dRow) = cel.Offset(0, 5)
End If
dRow = dRow + 1
Next 'cel
End Sub
-----
Jay



"mslabbe" wrote:

Is there slick way to have it go to a different tab and start in a different
cell INSTEAD of going to column BB? So If A1:A5000 Then F1:F500 copy and
paste into worksheet 'sheet3' B10:B510.



"Jay" wrote:

Hi mslabbe -

Here's one way:

Sub mslabbe()
For Each cel In Range("A1:A500")
If cel.Value 0 Then cel.Offset(0, 53) = _
cel.Offset(0, 5)
Next 'cel
End Sub

----
Jay



"mslabbe" wrote:

I totally screwed up...I posted this in the Access group. Anyway, I usually
find what I need but not this time...

I would like to run a macro based on a column. Example, if A7:A5000, then
copy F7:F500. Basically, if A7 is 0, I would like F7 to be copied and paste
in BB7, and for it to go down to 500.

Thanks in advance
Cheers

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
Macro Question David Excel Discussion (Misc queries) 3 April 30th 10 02:25 PM
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
macro question Knox Excel Programming 2 February 20th 07 07:20 PM
question on macro Harry Excel Discussion (Misc queries) 8 April 13th 06 04:25 PM
Question With Macro Keven[_2_] Excel Programming 2 April 29th 04 09:07 PM


All times are GMT +1. The time now is 03:48 PM.

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"