#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default rows

ehmmm.... it's me again....
my sheet contains 2 identical tables (it has to fit on an A4 paper). each
table has 4 columns and 17 rows... the data from my userform goes first in
row 1 (starts in B16) then in 2 etc...
when row 17 is full I need the data to go to the next table (starts in P16)
and down the next 17 rows.
To fill the first 17 rows I use this (thanks Steve Bell):

Private Sub cmdNext_Click()
Sheets("Sheet1").Cells(1, 30).Value = ComboClient.Text
Sheets("Sheet").Cells(9, 22).Value = UCase(TextData.Text)
Dim lrw As Long

lrw = Sheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Row

If lrw < 16 Then
lrw = 16
End If

Sheets("Sheet1").Cells(lrw, 2) = TxtCode.Value
Sheets("Sheet1").Cells(lrw, 4) = TxtBill.Value
Sheets("Sheet1").Cells(lrw, 8) = TxtExNr.Value
Sheets("Sheet1").Cells(lrw, 11) = TxtData.Value
End Sub

Any suggestions?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default rows

Hi,


Try this :

Option Explicit

Private Sub cmdNext_Click()
Sheets("Sheet1").Cells(1, 30).Value = ComboClient.Text
Sheets("Sheet").Cells(9, 22).Value = UCase(TextData.Text)
Dim lrw As Long
Dim col As Integer

col = 2 ' Column B
lrw = Sheets("Sheet1").Cells(Rows.Count, col).End(xlUp).Offset(1, 0).Row
If lrw 32 Then ' Column B is full
col = 16 ' Set to column P
lrw = Sheets("Sheet1").Cells(Rows.Count, col).End(xlUp).Offset(1, 0).Row
End If

If lrw < 16 Then
lrw = 16
End If

Sheets("Sheet1").Cells(lrw, col) = TxtCode.Value
Sheets("Sheet1").Cells(lrw, col + 2) = TxtBill.Value
Sheets("Sheet1").Cells(lrw, col + 6) = TxtExNr.Value
Sheets("Sheet1").Cells(lrw, col + 9) = TxtData.Value
End Sub


"antonov" wrote:

ehmmm.... it's me again....
my sheet contains 2 identical tables (it has to fit on an A4 paper). each
table has 4 columns and 17 rows... the data from my userform goes first in
row 1 (starts in B16) then in 2 etc...
when row 17 is full I need the data to go to the next table (starts in P16)
and down the next 17 rows.
To fill the first 17 rows I use this (thanks Steve Bell):

Private Sub cmdNext_Click()
Sheets("Sheet1").Cells(1, 30).Value = ComboClient.Text
Sheets("Sheet").Cells(9, 22).Value = UCase(TextData.Text)
Dim lrw As Long

lrw = Sheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Row

If lrw < 16 Then
lrw = 16
End If

Sheets("Sheet1").Cells(lrw, 2) = TxtCode.Value
Sheets("Sheet1").Cells(lrw, 4) = TxtBill.Value
Sheets("Sheet1").Cells(lrw, 8) = TxtExNr.Value
Sheets("Sheet1").Cells(lrw, 11) = TxtData.Value
End Sub

Any suggestions?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default rows

yep... that's it... it works just fine... thanks
"Toppers" wrote in message
...
Hi,


Try this :

Option Explicit

Private Sub cmdNext_Click()
Sheets("Sheet1").Cells(1, 30).Value = ComboClient.Text
Sheets("Sheet").Cells(9, 22).Value = UCase(TextData.Text)
Dim lrw As Long
Dim col As Integer

col = 2 ' Column B
lrw = Sheets("Sheet1").Cells(Rows.Count, col).End(xlUp).Offset(1, 0).Row
If lrw 32 Then ' Column B is full
col = 16 ' Set to column P
lrw = Sheets("Sheet1").Cells(Rows.Count, col).End(xlUp).Offset(1,
0).Row
End If

If lrw < 16 Then
lrw = 16
End If

Sheets("Sheet1").Cells(lrw, col) = TxtCode.Value
Sheets("Sheet1").Cells(lrw, col + 2) = TxtBill.Value
Sheets("Sheet1").Cells(lrw, col + 6) = TxtExNr.Value
Sheets("Sheet1").Cells(lrw, col + 9) = TxtData.Value
End Sub


"antonov" wrote:

ehmmm.... it's me again....
my sheet contains 2 identical tables (it has to fit on an A4 paper). each
table has 4 columns and 17 rows... the data from my userform goes first
in
row 1 (starts in B16) then in 2 etc...
when row 17 is full I need the data to go to the next table (starts in
P16)
and down the next 17 rows.
To fill the first 17 rows I use this (thanks Steve Bell):

Private Sub cmdNext_Click()
Sheets("Sheet1").Cells(1, 30).Value = ComboClient.Text
Sheets("Sheet").Cells(9, 22).Value = UCase(TextData.Text)
Dim lrw As Long

lrw = Sheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Row

If lrw < 16 Then
lrw = 16
End If

Sheets("Sheet1").Cells(lrw, 2) = TxtCode.Value
Sheets("Sheet1").Cells(lrw, 4) = TxtBill.Value
Sheets("Sheet1").Cells(lrw, 8) = TxtExNr.Value
Sheets("Sheet1").Cells(lrw, 11) = TxtData.Value
End Sub

Any suggestions?





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
colating multi rows of data into single rows - no to pivot tables! UKMAN Excel Worksheet Functions 4 March 12th 10 04:11 PM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
Counting characters in multiple rows when rows meet specific criteria news.virginmedia.com Excel Worksheet Functions 3 June 28th 08 09:03 PM
Copy rows of data (eliminating blank rows) from fixed layout Sweepea Excel Discussion (Misc queries) 1 March 13th 07 11:05 PM
Pivot Tables: How do I show ALL field rows, including empty rows?? [email protected] Excel Worksheet Functions 2 April 8th 05 06:21 PM


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