Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default offset every other row down a column (2 merged rows)

I have to send values from a form to column D every other row. Here is that
piece of code from my form. Currently, it sends only the first value
(Me.Pocket1.Value) then the loop ends. Could you tell me how to fix it?
I should mention that the reason why I'm trying to insert the value every
other row is because every 2 rows are merged down column D (such as D3:D4 are
merged and so on).

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(2, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = Me.Pocket1.Value
ActiveCell.Offset(2, 0) = Me.Pocket2.Value
ActiveCell.Offset(4, 0) = Me.Pocket3.Value
ActiveCell.Offset(6, 0) = Me.Pocket4.Value
ActiveCell.Offset(8, 0) = Me.Pocket5.Value
ActiveCell.Offset(10, 0) = Me.Pocket6.Value
ActiveCell.Offset(12, 0) = Me.Pocket7.Value
ActiveCell.Offset(14, 0) = Me.Pocket8.Value

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default offset every other row down a column (2 merged rows)


With ActiveSheet
iLastRow = .Cells(.Rows.Count,"D").End(xlUp).Row + 1
.Cells(ilastrow+2, "D").Value = Me.Pocket1.Value
.Cells(ilastrow+4, "D").Value = Me.Pocket2.Value
.Cells(ilastrow+6, "D").Value = Me.Pocket3.Value
.Cells(ilastrow+8, "D").Value = Me.Pocket4.Value
.Cells(ilastrow+10, "D").Value = Me.Pocket5.Value
.Cells(ilastrow+12, "D").Value = Me.Pocket6.Value
.Cells(ilastrow+14, "D").Value = Me.Pocket7.Value
.Cells(ilastrow+16, "D").Value = Me.Pocket8.Value
End With

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"cj2k2k" wrote in message
...
I have to send values from a form to column D every other row. Here is
that
piece of code from my form. Currently, it sends only the first value
(Me.Pocket1.Value) then the loop ends. Could you tell me how to fix it?
I should mention that the reason why I'm trying to insert the value every
other row is because every 2 rows are merged down column D (such as D3:D4
are
merged and so on).

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(2, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = Me.Pocket1.Value
ActiveCell.Offset(2, 0) = Me.Pocket2.Value
ActiveCell.Offset(4, 0) = Me.Pocket3.Value
ActiveCell.Offset(6, 0) = Me.Pocket4.Value
ActiveCell.Offset(8, 0) = Me.Pocket5.Value
ActiveCell.Offset(10, 0) = Me.Pocket6.Value
ActiveCell.Offset(12, 0) = Me.Pocket7.Value
ActiveCell.Offset(14, 0) = Me.Pocket8.Value



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
Offset every 27th row in a column that is 2 cells wide (merged cel KS Excel Worksheet Functions 4 March 19th 08 02:00 AM
Offset and Merged cells Jim[_7_] Excel Programming 3 October 13th 06 04:21 PM
Freeze objects in column with merged rows [email protected] Excel Discussion (Misc queries) 6 August 28th 06 10:17 PM
Can I set a filter for a merged column across multiple rows and o. Martin Excel Worksheet Functions 2 November 25th 04 01:01 PM
How to tell : how many rows a merged Column run over .. smallville[_2_] Excel Programming 1 January 4th 04 08:05 AM


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