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

I have a macro which copies specific information from a target row on one
worksheet, and copies that information to the first blank cell it finds on a
designated worksheet. However, I need for it to begin looking for the first
blank cell on row 12. Here is the macro I currently have:

Sub CopyRetailerInfo()
Dim BlankCell As Integer

Range(ActiveCell, ActiveCell.Offset(0, 4)).Copy
Worksheets("Field Activity Report").Select
BlankCell = Application.WorksheetFunction.CountA(Worksheets("F ield Activity
Report").Range("D:D")) + 1
Worksheets("Field Activity Report").Cells(BlankCell, 4).Select
Selection.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
Worksheets("Survey Spreadsheet").Select
End Sub

Can you help correct this macro so it begins on row 12? Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Specific Row Designation

One way:

Public Sub CopyRetailerInfo()
Dim rDest As Range
With Worksheets("Field Activity Report")
Set rDest = .Range("D" & Rows.Count).End(xlUp).Offset(1, 0)
If rDest.Row < 12 Then Set rDest = .Range("D12")
End With
rDest.Resize(1, 5).Value = ActiveCell.Resize(1, 5).Value
End Sub

Note that selection/activation is almost never needed. Using the range
objects directly is faster, generates smaller code, and IMO, is easier
to maintain.



In article ,
"Larry" wrote:

I have a macro which copies specific information from a target row on one
worksheet, and copies that information to the first blank cell it finds on a
designated worksheet. However, I need for it to begin looking for the first
blank cell on row 12. Here is the macro I currently have:

Sub CopyRetailerInfo()
Dim BlankCell As Integer

Range(ActiveCell, ActiveCell.Offset(0, 4)).Copy
Worksheets("Field Activity Report").Select
BlankCell = Application.WorksheetFunction.CountA(Worksheets("F ield Activity
Report").Range("D:D")) + 1
Worksheets("Field Activity Report").Cells(BlankCell, 4).Select
Selection.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
Worksheets("Survey Spreadsheet").Select
End Sub

Can you help correct this macro so it begins on row 12? Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default Specific Row Designation

Thanks, that does work and your information was exactly right. I found that
changing Range("D:D")) + 1 to Range("D:D")) +10 moved the information down
to the row I was shooting for. Thanks for all your help!

"JE McGimpsey" wrote:

One way:

Public Sub CopyRetailerInfo()
Dim rDest As Range
With Worksheets("Field Activity Report")
Set rDest = .Range("D" & Rows.Count).End(xlUp).Offset(1, 0)
If rDest.Row < 12 Then Set rDest = .Range("D12")
End With
rDest.Resize(1, 5).Value = ActiveCell.Resize(1, 5).Value
End Sub

Note that selection/activation is almost never needed. Using the range
objects directly is faster, generates smaller code, and IMO, is easier
to maintain.



In article ,
"Larry" wrote:

I have a macro which copies specific information from a target row on one
worksheet, and copies that information to the first blank cell it finds on a
designated worksheet. However, I need for it to begin looking for the first
blank cell on row 12. Here is the macro I currently have:

Sub CopyRetailerInfo()
Dim BlankCell As Integer

Range(ActiveCell, ActiveCell.Offset(0, 4)).Copy
Worksheets("Field Activity Report").Select
BlankCell = Application.WorksheetFunction.CountA(Worksheets("F ield Activity
Report").Range("D:D")) + 1
Worksheets("Field Activity Report").Cells(BlankCell, 4).Select
Selection.PasteSpecial (xlPasteValues)
Application.CutCopyMode = False
Worksheets("Survey Spreadsheet").Select
End Sub

Can you help correct this macro so it begins on row 12? Thanks for your help.


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
Line chart - Series designation Mike Excel Discussion (Misc queries) 1 May 8th 09 08:37 PM
column designation has started to appear as numbers Bert Excel Discussion (Misc queries) 3 May 7th 07 12:43 PM
Removing file [Group] designation Bob_bcbpd Excel Discussion (Misc queries) 3 June 27th 06 05:00 PM
cell designation wickd03 Excel Discussion (Misc queries) 5 March 23rd 06 08:49 PM
Columns with # designation swynne Excel Discussion (Misc queries) 3 December 28th 05 04:21 PM


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