“3×8=24”가다~~~

作者在3月8日迎来24岁生日,当天经历丰富。凌晨才睡,早上被吵醒,之后上日语课、去实验室、跳现代舞,下午干活效率提高。晚上上英语口音矫正课,觉得荒唐。下课后碰到很多女生,还听到女孩哭泣。作者感慨与‘巧’有缘,决定记录这特别的生日。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天,3月8日,两个节日:妇女节和我生日(按阴历,按阳历的话应该是我小弟的生日:),esp.24岁生日。本世纪第三件巧事:3×8=24(对,这应该是发生在我身上的第三件巧事了:99年12月31日和00年12月31日。)。很特别,然而我确是刚刚想到~!看来今晚要庆祝一下~!

but,今天也算是“经历”颇多了。凌晨00:56回寝睡觉,早上6点左右被阿姨“哗啦哗啦的涮墩布声和嘎嗒嘎嗒的皮鞋声”弄得我像蓝皮鼠耳朵里住近了音乐家——悠哉而辗转难眠。熬到7:13就爬起来了,头晕是肯定的了!不过“精神胜利法”给了我一个好心情。乐癫儿癫儿地跑去食堂打了两个生日鸡蛋和一代加锌牛奶。1-2节的日语课,居然上的越来越精神。不过3-4节回到实验室干脆就爬了两个多钟头。中午饭也没了胃口,还好下午去跳现代舞,因上周两次课没来,so,“我是伸不开腿,我跟不上溜,你说难受啊~~不难受”,知道自己跳得比机器人还难看。(记得学体操时也没这么难啊~!)一个半小时下来,出了一身臭汉,但精神多了而且感觉身体的协调性有所提高。虽然还是跟不上节拍,届时手脚不知往哪儿放,but,整套动作到是记住了。明天中午在跳时多练练就好了。——现代舞确实比拉丁舞(现在学的是“恰恰”)要难,一是节拍快,二是手脚协调与韵律性强才好看。但拉丁舞有个好处是可以与mm一起跳。

日语和跳舞使得我精神亢奋,下午在实验室干活也有效率多了。晚上9-11节的英语口音矫正课就有些荒唐的可笑了。漂亮的英语老师带领着我回到了小学五年级(真的很巧那时我12岁,第一个本命年~!)开始从头学IPA(Internetional Phonetic Alphabet:国际音标),一个一个领着读,大家还真认真“大婶朗读”。ok,确实有一些人“舌头”有些问题,但是教来教去,我们这些本来会读的反倒变得不会读了,兹决定This is the last class~!(虽然老师漂亮:)中间给我放了一段外国老教音标的视频,我怎么看怎么觉着他少了颗“门牙”,hehe。

下课后回实验室,碰到老多来材院上外教口语课的mm,看来还是“本土”有活力。but,楼梯角落却幽幽地传来女孩的哭泣声,额就好奇冽,原来在电话中“情到浓时”@_@

有意思地有~`~~  由此我也感觉到24年中我真的跟“巧”(或 Lucky)有缘。这是不是所谓“天象”我不知,但我真的感到好幸运,也许是我太过于刻意才……??No,No……

过个“巧”的24岁生日,已经两轮了~!没有告诉朋友,因为知道对他人这是件“尴尬事儿”,只要自己记得他人的生日就够了。Now,收拾一下心情,并告知老朋友一声,留作纪念。在上个世纪形成了写思记的习惯,我留住了好多宝贵的回忆,i'll go on~!

Sub R3_MACRO() &#39;Sheet 1 작업 Sheets(1).Select Call R3_ITME &#39;Sheet 2 작업 Sheets(2).Select Call R3_ITME_Sheet4 &#39;Sheet 3 작업 Sheets(3).Select Call R3_ITME_Sheet2 &#39;Sheet 4 작업 Sheets(4).Select Call R3_ITME_Sheet3 End Sub Sub R3_ITME() Dim r_count1 As Long &#39;Head Dim r_count2 As Long &#39;Item &#39; Dim r_count3 As Long &#39;job Order Dim r3table_1 As Object &#39; Dim r3table_2 As Object &#39; &#39; Dim r3table_3 As Object &#39; Dim onePageCnt As Long &#39;한 page의 라인 수 Dim topPageCnt As Long &#39;top page의 라인수 Dim firstTopPageCnt As Long &#39;sub top page는 첫 page일 때만 출력 Dim lastBottomPageCnt As Long &#39;마지막 page 시 사용하는 바닥글 Dim bottomPageCnt As Long &#39;바닥글 라인 수 Dim totalPageCnt As Long &#39;토탈 페이지수 &#39;Dim last_itemEndLine As Long &#39;item의 마지막 라인 &#39;Dim last_LastStaLine As Long &#39;마지막 page 시 사용하는 바닥글 시작 라인 &#39;Dim last_LastEndLine As Long &#39;마지막 page 시 사용하는 바닥글 마지막 라인 Set r3table_1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table Set r3table_2 = ThisWorkbook.Container.LinkServer.Items("ITEM").Table &#39; Set r3table_3 = ThisWorkbook.Container.LinkServer.Items("ZJOB").Table r_count1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table.RowCount r_count2 = ThisWorkbook.Container.LinkServer.Items("ITEM").Table.RowCount &#39; r_count3 = ThisWorkbook.Container.LinkServer.Items("ZJOB").Table.RowCount &#39; 0. (중복으로 출력할) 해더&바텀 DATA 미리 입력 하기 ThisWorkbook.Sheets(1).Cells(6, 2) = r3table_1.Value(1, 1) &#39;Order From ThisWorkbook.Sheets(1).Cells(6, 6) = r3table_1.Value(1, 2) &#39;Deliver To ThisWorkbook.Sheets(1).Cells(7, 11) = r3table_1.Value(1, 3) &#39;PO ThisWorkbook.Sheets(1).Cells(8, 11) = r3table_1.Value(1, 4) &#39;Date &#39;ThisWorkbook.Sheets(1).Cells(7, 10) = r3table_1.Value(1, 5) &#39;JO ThisWorkbook.Sheets(1).Cells(10, 2) = r3table_1.Value(1, 26) &#39;GST Registration No. ThisWorkbook.Sheets(1).Cells(10, 4) = r3table_1.Value(1, 6) &#39;GST Registration No. ThisWorkbook.Sheets(1).Cells(11, 3) = r3table_1.Value(1, 24) &#39;Attn ThisWorkbook.Sheets(1).Cells(12, 3) = r3table_1.Value(1, 7) &#39;Phone ThisWorkbook.Sheets(1).Cells(13, 3) = r3table_1.Value(1, 8) &#39;Email ThisWorkbook.Sheets(1).Cells(11, 11) = r3table_1.Value(1, 9) &#39;Service Client ThisWorkbook.Sheets(1).Cells(12, 11) = r3table_1.Value(1, 10) &#39;Client Reference1 ThisWorkbook.Sheets(1).Cells(13, 11) = r3table_1.Value(1, 11) &#39;Client Reference2 ThisWorkbook.Sheets(1).Cells(14, 11) = r3table_1.Value(1, 12) &#39;Client Reference3 ThisWorkbook.Sheets(1).Cells(17, 2) = r3table_1.Value(1, 13) &#39;Delivery Date ThisWorkbook.Sheets(1).Cells(17, 5) = r3table_1.Value(1, 14) &#39;Payment Term ThisWorkbook.Sheets(1).Cells(17, 7) = r3table_1.Value(1, 15) &#39;Currency ThisWorkbook.Sheets(1).Cells(17, 9) = r3table_1.Value(1, 16) &#39;Exchange Rate ThisWorkbook.Sheets(1).Cells(49, 4) = r3table_1.Value(1, 17) &#39;Workflow Status ThisWorkbook.Sheets(1).Cells(51, 4) = r3table_1.Value(1, 18) &#39;Requested by ThisWorkbook.Sheets(1).Cells(52, 4) = r3table_1.Value(1, 19) &#39;Approved by &#39; Total ThisWorkbook.Sheets(1).Cells(48, 13) = r3table_1.Value(1, 20) &#39;Lines subtotal ThisWorkbook.Sheets(1).Cells(49, 13) = r3table_1.Value(1, 21) &#39;Misc. Charge Subtotal ThisWorkbook.Sheets(1).Cells(50, 13) = r3table_1.Value(1, 25) &#39;Add GST ThisWorkbook.Sheets(1).Cells(51, 12) = r3table_1.Value(1, 15) &#39;Currency ThisWorkbook.Sheets(1).Cells(51, 13) = r3table_1.Value(1, 22) &#39;Total &#39; SK Adress 바닥들 &#39; ThisWorkbook.Sheets(1).Cells(48, 1) = r3table_1.Value(1, 23) &#39;Detail &#39; ThisWorkbook.Sheets(1).Cells(49, 1) = r3table_1.Value(1, 24) &#39;Detail &#39; ThisWorkbook.Sheets(1).Cells(50, 1) = r3table_1.Value(1, 25) &#39;Detail &#39; 0. Area 라인 onePageCnt = 62 &#39; 한 page의 라인 수 topPageCnt = 10 &#39;top page의 라인수 firstTopPageCnt = 8 &#39; sub top page는 첫 page일 때만 출력 lastBottomPageCnt = 6 &#39;마지막 page 시 사용하는 바닥글 bottomPageCnt = 9 &#39;바닥글 라인 수 dispCell = "M" &#39;출력마지막 CELL If r3table_1.Value(1, 26) <> "" Then &#39;GST Registration No. Range("D10").Select Selection.HorizontalAlignment = xlLeft Selection.VerticalAlignment = xlCenter End If &#39; 1. 총 페이지수를 계산 하기 &#39;r_count2 = 52 &#39;item의 라인수 &#39;1. 첫페이지만 있을 경우의 item 가능 라인수 lv_cnt_1 = onePageCnt - topPageCnt - firstTopPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;2. 첫페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_2 = onePageCnt - topPageCnt - firstTopPageCnt - bottomPageCnt - 1 &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_3 = onePageCnt - topPageCnt - bottomPageCnt - 1 &#39;4. 2번째 페이지가 마지막 페이지 일 경우 item 가능 라인수 lv_cnt_4 = onePageCnt - topPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;--- 1. 1페이지에 넣을 수 있는지 확인 lv_v1 = r_count2 - lv_cnt_1 If lv_v1 > 0 Then &#39;--- 2. 2페이지에 넣을 수 있는지 확인 lv_v2 = r_count2 - lv_cnt_2 - lv_cnt_4 If lv_v2 > 0 Then lv_d1 = lv_v2 \ lv_cnt_3 lv_f1 = lv_v2 Mod lv_cnt_3 If lv_f1 > 0 Then totalPageCnt = lv_d1 + 3 Else totalPageCnt = lv_d1 + 2 End If Else totalPageCnt = 2 End If Else totalPageCnt = 1 End If &#39; 2. 페이지 copy and paste &#39;1. copy and set startRow = 1 endRow = onePageCnt activRow = 1 endRow8 = endRow - 7 ThisWorkbook.Sheets(1).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT If totalPageCnt > 1 Then &#39; 첫 페이지를 copy Range("A" & startRow & ":" & "M" & endRow).Select Selection.Copy For lv_1 = 1 To totalPageCnt - 1 activRow = activRow + onePageCnt Cells(activRow, 1).Select ActiveSheet.Paste startRow = startRow + onePageCnt endRow = endRow + onePageCnt endRow9 = endRow - bottomPageCnt - 1 Rows(endRow9 & ":" & endRow).Select Selection.RowHeight = 12.5 endRow8 = endRow9 + 3 ThisWorkbook.Sheets(1).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT Next lv_1 &#39;2. 2번째 페이지의 firstTopPage를 삭제 If firstTopPageCnt > 0 Then firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 1 itemendRow = itemstartRow + firstTopPageCnt - 1 itemstartRow_V2 = itemstartRow + 1 itemendRow_V2 = itemstartRow_V2 + 1 For lv_1 = 1 To totalPageCnt If lv_1 > 1 Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = firstTopstartRow Cells(activRow, 1).Select ActiveSheet.Paste Range("A" & itemstartRow_V2 & ":" & "M" & itemendRow_V2).Select Selection.Copy activRow = itemstartRow Cells(activRow, 1).Select ActiveSheet.Paste End If firstTopstartRow = firstTopstartRow + onePageCnt firstTopendRow = firstTopendRow + onePageCnt &#39;2번째 페이지부터 GST Registration No 삭제 clearrow = firstTopstartRow - 1 If firstTopstartRow <> topPageCnt Then Range("B" & clearrow & ":" & "D" & clearrow).Select Selection.ClearContents End If itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt itemstartRow_V2 = itemstartRow_V2 + onePageCnt itemendRow_V2 = itemendRow_V2 + onePageCnt Next lv_1 End If &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 lastBottomPage를 삭제 If lastBottomPageCnt > 0 Then lastBottomstartRow = onePageCnt - bottomPageCnt - lastBottomPageCnt + 1 lastBottomendRow = lastBottomstartRow + firstTopPageCnt - 1 itemstartRow = lastBottomstartRow - lastBottomPageCnt - 1 itemendRow = itemstartRow + lastBottomPageCnt For lv_1 = 1 To totalPageCnt If lv_1 <> totalPageCnt Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = itemendRow Cells(activRow, 1).Select ActiveSheet.Paste End If lastBottomstartRow = lastBottomstartRow + onePageCnt lastBottomendRow = lastBottomendRow + onePageCnt itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt Next lv_1 &#39; 최종 sub 바닥글의 위치 정보 &#39;last_LastStaLine = lastBottomstartRow - onePageCnt &#39;last_LastEndLine = lastBottomendRow - onePageCnt - 1 End If &#39;Else &#39;lastBottomstartRow = onePageCnt - bottomPageCnt - lastBottomPageCnt + 1 &#39;lastBottomendRow = lastBottomstartRow + firstTopPageCnt - 1 &#39;last_LastStaLine = lastBottomstartRow &#39;last_LastEndLine = lastBottomendRow - 1 End If &#39; 3. item data 출력 하기 firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 2 currPage = 1 For itemLine = 1 To r_count2 pageLine = pageLine + 1 If currPage = 1 Then &#39;첫 페이지 If totalPageCnt = currPage Then If pageLine > lv_cnt_1 Then &#39;첫 페이지가 마지막 페이지가 일 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If Else If pageLine > lv_cnt_2 Then &#39;첫 페이지가 마지막 페이지가 아닐 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If ElseIf totalPageCnt = currPage Then &#39; 마지막 페이지 Else &#39; 기타 페이지 If pageLine > lv_cnt_3 Then pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If &#39;==========> 여기서 item을 출력 하면 됩니다. ==========< Range("D" & itemstartRow & ":" & "F" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("I" & itemstartRow & ":" & "K" & itemstartRow).Select Selection.UnMerge Range("H" & itemstartRow & ":" & "I" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("L" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("A" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlLeft Range("G" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlRight ThisWorkbook.Sheets(1).Cells(itemstartRow, 2) = r3table_2.Value(itemLine, 1) &#39;Line ThisWorkbook.Sheets(1).Cells(itemstartRow, 4) = r3table_2.Value(itemLine, 2) &#39;Description ThisWorkbook.Sheets(1).Cells(itemstartRow, 7) = r3table_2.Value(itemLine, 3) &#39;Quantity ThisWorkbook.Sheets(1).Cells(itemstartRow, 8) = r3table_2.Value(itemLine, 4) &#39;Unit Price ThisWorkbook.Sheets(1).Cells(itemstartRow, 11) = r3table_2.Value(itemLine, 7) &#39;Tax ThisWorkbook.Sheets(1).Cells(itemstartRow, 12) = r3table_2.Value(itemLine, 5) &#39;Amount Range("K" & itemstartRow).Select Selection.NumberFormatLocal = "0%" Range("G" & itemstartRow & ":" & "I" & itemstartRow & "," & "L" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.NumberFormatLocal = "#,##0.00" itemstartRow = itemstartRow + 1 Next itemLine &#39; 3. last 바닥글의 위치를 조정 하기 &#39; item의 마지막 라인 &#39;itemEndLine = itemstartRow + 3 &#39;Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39;Selection.Copy &#39;Cells(itemEndLine, 1).Select &#39;ActiveSheet.Paste &#39;&#39;전에 있던 last 바닥글을 지우기 &#39;Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39;Selection.Clear &#39; 4. 프린트 페이지를 지정하기 plt = totalPageCnt * onePageCnt &#39;최종 페이지 라인 &#39; 4-1 최종 페이지 지정 ActiveSheet.PageSetup.PrintArea = "A1:" & dispCell & plt &#39;최종 페이지의 프린트 영역지정 &#39; 4-2 페이지 분할 개수 pageBreakCnt = ActiveWindow.SelectedSheets.HPageBreaks.Count &#39; 4-3 페이지 분할 위치 지정 하기 For l2 = 1 To totalPageCnt &#39; 분할 페이지 이치 page_line = onePageCnt * l2 plt = page_line + 1 &#39; -1 프린트 페이지 수 &#39; 분할 페이지 라인이 부족 시 분할 라인 추가 If l2 > pageBreakCnt Then Cells(plt, 1).Select ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell &#39; 프린트 페이지 삽입 End If &#39; 최종 분할 라인 위치를 를 지정 If l2 <> totalPageCnt Then Set ActiveSheet.HPageBreaks(l2).Location = Range("A" & plt) End If Next l2 &#39; 5. 페이지 / 총 페이지 출력 dispPageRow = 10 &#39;2 &#39;Page Row(시작) dispPageCell = 9 &#39;14 &#39;Page Column For L1 = 1 To totalPageCnt Cells(dispPageRow, dispPageCell).Select pagenumber &#39;페이지 넘버 출력 dispPageRow = dispPageRow + onePageCnt Next L1 End Sub Sub R3_ITME_Sheet4() Dim r_count1 As Long &#39;Head Dim r_count2 As Long &#39;Item &#39; Dim r_count3 As Long &#39;job Order Dim r3table_1 As Object &#39; Dim r3table_2 As Object &#39; &#39; Dim r3table_3 As Object &#39; Dim onePageCnt As Long &#39;한 page의 라인 수 Dim topPageCnt As Long &#39;top page의 라인수 Dim firstTopPageCnt As Long &#39;sub top page는 첫 page일 때만 출력 Dim lastBottomPageCnt As Long &#39;마지막 page 시 사용하는 바닥글 Dim bottomPageCnt As Long &#39;바닥글 라인 수 Dim totalPageCnt As Long &#39;토탈 페이지수 &#39;Dim last_itemEndLine As Long &#39;item의 마지막 라인 &#39;Dim last_LastStaLine As Long &#39;마지막 page 시 사용하는 바닥글 시작 라인 &#39;Dim last_LastEndLine As Long &#39;마지막 page 시 사용하는 바닥글 마지막 라인 Set r3table_1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table Set r3table_2 = ThisWorkbook.Container.LinkServer.Items("ITEM").Table &#39; Set r3table_3 = ThisWorkbook.Container.LinkServer.Items("ZJOB").Table r_count1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table.RowCount r_count2 = ThisWorkbook.Container.LinkServer.Items("ITEM").Table.RowCount &#39; r_count3 = ThisWorkbook.Container.LinkServer.Items("ZJOB").Table.RowCount &#39; 0. (중복으로 출력할) 해더&바텀 DATA 미리 입력 하기 ThisWorkbook.Sheets(2).Cells(6, 2) = r3table_1.Value(1, 1) &#39;Order From ThisWorkbook.Sheets(2).Cells(6, 6) = r3table_1.Value(1, 2) &#39;Deliver To ThisWorkbook.Sheets(2).Cells(7, 11) = r3table_1.Value(1, 3) &#39;PO ThisWorkbook.Sheets(2).Cells(8, 11) = r3table_1.Value(1, 4) &#39;Date &#39;ThisWorkbook.Sheets(2).Cells(7, 10) = r3table_1.Value(1, 5) &#39;JO ThisWorkbook.Sheets(2).Cells(10, 2) = r3table_1.Value(1, 26) &#39;GST Registration No. ThisWorkbook.Sheets(2).Cells(10, 4) = r3table_1.Value(1, 6) &#39;GST Registration No. ThisWorkbook.Sheets(2).Cells(11, 3) = r3table_1.Value(1, 24) &#39;Attn ThisWorkbook.Sheets(2).Cells(12, 3) = r3table_1.Value(1, 7) &#39;Phone ThisWorkbook.Sheets(2).Cells(13, 3) = r3table_1.Value(1, 8) &#39;Email ThisWorkbook.Sheets(2).Cells(11, 11) = r3table_1.Value(1, 9) &#39;Service Client ThisWorkbook.Sheets(2).Cells(12, 11) = r3table_1.Value(1, 10) &#39;Client Reference1 ThisWorkbook.Sheets(2).Cells(13, 11) = r3table_1.Value(1, 11) &#39;Client Reference2 ThisWorkbook.Sheets(2).Cells(14, 11) = r3table_1.Value(1, 12) &#39;Client Reference3 ThisWorkbook.Sheets(2).Cells(17, 2) = r3table_1.Value(1, 13) &#39;Delivery Date ThisWorkbook.Sheets(2).Cells(17, 5) = r3table_1.Value(1, 14) &#39;Payment Term ThisWorkbook.Sheets(2).Cells(17, 7) = r3table_1.Value(1, 15) &#39;Currency ThisWorkbook.Sheets(2).Cells(17, 9) = r3table_1.Value(1, 16) &#39;Exchange Rate &#39;ThisWorkbook.Sheets(2).Cells(49, 4) = r3table_1.Value(1, 17) &#39;Workflow Status &#39;ThisWorkbook.Sheets(2).Cells(51, 4) = r3table_1.Value(1, 18) &#39;Requested by &#39;ThisWorkbook.Sheets(2).Cells(52, 4) = r3table_1.Value(1, 19) &#39;Approved by &#39; Total ThisWorkbook.Sheets(2).Cells(48, 13) = r3table_1.Value(1, 20) &#39;Lines subtotal ThisWorkbook.Sheets(2).Cells(49, 13) = r3table_1.Value(1, 21) &#39;Misc. Charge Subtotal ThisWorkbook.Sheets(2).Cells(50, 13) = r3table_1.Value(1, 25) &#39;Add GST ThisWorkbook.Sheets(2).Cells(51, 12) = r3table_1.Value(1, 15) &#39;Currency ThisWorkbook.Sheets(2).Cells(51, 13) = r3table_1.Value(1, 22) &#39;Total &#39; SK Adress 바닥들 &#39; ThisWorkbook.Sheets(2).Cells(48, 1) = r3table_1.Value(1, 23) &#39;Detail &#39; ThisWorkbook.Sheets(2).Cells(49, 1) = r3table_1.Value(1, 24) &#39;Detail &#39; ThisWorkbook.Sheets(2).Cells(50, 1) = r3table_1.Value(1, 25) &#39;Detail &#39; 0. Area 라인 onePageCnt = 62 &#39; 한 page의 라인 수 topPageCnt = 10 &#39;top page의 라인수 firstTopPageCnt = 8 &#39; sub top page는 첫 page일 때만 출력 lastBottomPageCnt = 6 &#39;마지막 page 시 사용하는 바닥글 bottomPageCnt = 9 &#39;바닥글 라인 수 dispCell = "M" &#39;출력마지막 CELL If r3table_1.Value(1, 26) <> "" Then &#39;GST Registration No. Range("D10").Select Selection.HorizontalAlignment = xlLeft Selection.VerticalAlignment = xlCenter End If &#39; 1. 총 페이지수를 계산 하기 &#39;r_count2 = 52 &#39;item의 라인수 &#39;1. 첫페이지만 있을 경우의 item 가능 라인수 lv_cnt_1 = onePageCnt - topPageCnt - firstTopPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;2. 첫페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_2 = onePageCnt - topPageCnt - firstTopPageCnt - bottomPageCnt - 1 &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_3 = onePageCnt - topPageCnt - bottomPageCnt - 1 &#39;4. 2번째 페이지가 마지막 페이지 일 경우 item 가능 라인수 lv_cnt_4 = onePageCnt - topPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;--- 1. 1페이지에 넣을 수 있는지 확인 lv_v1 = r_count2 - lv_cnt_1 If lv_v1 > 0 Then &#39;--- 2. 2페이지에 넣을 수 있는지 확인 lv_v2 = r_count2 - lv_cnt_2 - lv_cnt_4 If lv_v2 > 0 Then lv_d1 = lv_v2 \ lv_cnt_3 lv_f1 = lv_v2 Mod lv_cnt_3 If lv_f1 > 0 Then totalPageCnt = lv_d1 + 3 Else totalPageCnt = lv_d1 + 2 End If Else totalPageCnt = 2 End If Else totalPageCnt = 1 End If &#39; 2. 페이지 copy and paste &#39;1. copy and set startRow = 1 endRow = onePageCnt activRow = 1 endRow8 = endRow - 7 ThisWorkbook.Sheets(2).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT If totalPageCnt > 1 Then &#39; 첫 페이지를 copy Range("A" & startRow & ":" & "M" & endRow).Select Selection.Copy For lv_1 = 1 To totalPageCnt - 1 activRow = activRow + onePageCnt Cells(activRow, 1).Select ActiveSheet.Paste startRow = startRow + onePageCnt endRow = endRow + onePageCnt endRow9 = endRow - bottomPageCnt - 1 Rows(endRow9 & ":" & endRow).Select Selection.RowHeight = 12.5 endRow8 = endRow9 + 3 ThisWorkbook.Sheets(2).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT Next lv_1 &#39;2. 2번째 페이지의 firstTopPage를 삭제 If firstTopPageCnt > 0 Then firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 1 itemendRow = itemstartRow + firstTopPageCnt - 1 itemstartRow_V2 = itemstartRow + 1 itemendRow_V2 = itemstartRow_V2 + 1 For lv_1 = 1 To totalPageCnt If lv_1 > 1 Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = firstTopstartRow Cells(activRow, 1).Select ActiveSheet.Paste Range("A" & itemstartRow_V2 & ":" & "M" & itemendRow_V2).Select Selection.Copy activRow = itemstartRow Cells(activRow, 1).Select ActiveSheet.Paste End If firstTopstartRow = firstTopstartRow + onePageCnt firstTopendRow = firstTopendRow + onePageCnt &#39;2번째 페이지부터 GST Registration No 삭제 clearrow = firstTopstartRow - 1 If firstTopstartRow <> topPageCnt Then Range("B" & clearrow & ":" & "D" & clearrow).Select Selection.ClearContents End If itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt itemstartRow_V2 = itemstartRow_V2 + onePageCnt itemendRow_V2 = itemendRow_V2 + onePageCnt Next lv_1 End If &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 lastBottomPage를 삭제 If lastBottomPageCnt > 0 Then lastBottomstartRow = onePageCnt - bottomPageCnt - lastBottomPageCnt + 1 lastBottomendRow = lastBottomstartRow + firstTopPageCnt - 1 itemstartRow = lastBottomstartRow - lastBottomPageCnt - 1 itemendRow = itemstartRow + lastBottomPageCnt For lv_1 = 1 To totalPageCnt If lv_1 <> totalPageCnt Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = itemendRow Cells(activRow, 1).Select ActiveSheet.Paste End If lastBottomstartRow = lastBottomstartRow + onePageCnt lastBottomendRow = lastBottomendRow + onePageCnt itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt Next lv_1 &#39; 최종 sub 바닥글의 위치 정보 &#39;last_LastStaLine = lastBottomstartRow - onePageCnt &#39;last_LastEndLine = lastBottomendRow - onePageCnt - 1 End If &#39;Else &#39;lastBottomstartRow = onePageCnt - bottomPageCnt - lastBottomPageCnt + 1 &#39;lastBottomendRow = lastBottomstartRow + firstTopPageCnt - 1 &#39;last_LastStaLine = lastBottomstartRow &#39;last_LastEndLine = lastBottomendRow - 1 End If &#39; 3. item data 출력 하기 firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 2 currPage = 1 For itemLine = 1 To r_count2 pageLine = pageLine + 1 If currPage = 1 Then &#39;첫 페이지 If totalPageCnt = currPage Then If pageLine > lv_cnt_1 Then &#39;첫 페이지가 마지막 페이지가 일 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If Else If pageLine > lv_cnt_2 Then &#39;첫 페이지가 마지막 페이지가 아닐 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If ElseIf totalPageCnt = currPage Then &#39; 마지막 페이지 Else &#39; 기타 페이지 If pageLine > lv_cnt_3 Then pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If &#39;==========> 여기서 item을 출력 하면 됩니다. ==========< Range("D" & itemstartRow & ":" & "F" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("I" & itemstartRow & ":" & "K" & itemstartRow).Select Selection.UnMerge Range("H" & itemstartRow & ":" & "I" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("L" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("A" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlLeft Range("G" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlRight ThisWorkbook.Sheets(2).Cells(itemstartRow, 2) = r3table_2.Value(itemLine, 6) &#39;Line ThisWorkbook.Sheets(2).Cells(itemstartRow, 4) = r3table_2.Value(itemLine, 2) &#39;Description ThisWorkbook.Sheets(2).Cells(itemstartRow, 7) = r3table_2.Value(itemLine, 3) &#39;Quantity ThisWorkbook.Sheets(2).Cells(itemstartRow, 8) = r3table_2.Value(itemLine, 4) &#39;Unit Price ThisWorkbook.Sheets(2).Cells(itemstartRow, 11) = r3table_2.Value(itemLine, 7) &#39;Tax ThisWorkbook.Sheets(2).Cells(itemstartRow, 12) = r3table_2.Value(itemLine, 5) &#39;Amount Range("K" & itemstartRow).Select Selection.NumberFormatLocal = "0%" Range("G" & itemstartRow & ":" & "I" & itemstartRow & "," & "L" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.NumberFormatLocal = "#,##0.00" itemstartRow = itemstartRow + 1 Next itemLine &#39; 3. last 바닥글의 위치를 조정 하기 &#39; item의 마지막 라인 &#39;itemEndLine = itemstartRow + 3 &#39;Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39;Selection.Copy &#39;Cells(itemEndLine, 1).Select &#39;ActiveSheet.Paste &#39;&#39;전에 있던 last 바닥글을 지우기 &#39;Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39;Selection.Clear &#39; 4. 프린트 페이지를 지정하기 plt = totalPageCnt * onePageCnt &#39;최종 페이지 라인 &#39; 4-1 최종 페이지 지정 &#39;ActiveSheet.PageSetup.PrintArea = "A1:" & dispCell & plt &#39;최종 페이지의 프린트 영역지정 ThisWorkbook.Sheets(2).PageSetup.PrintArea = "A1:" & dispCell & plt &#39;최종 페이지의 프린트 영역지정 &#39; 4-2 페이지 분할 개수 pageBreakCnt = ActiveWindow.SelectedSheets.HPageBreaks.Count &#39; 4-3 페이지 분할 위치 지정 하기 For l2 = 1 To totalPageCnt &#39; 분할 페이지 이치 page_line = onePageCnt * l2 plt = page_line + 1 &#39; -1 프린트 페이지 수 &#39; 분할 페이지 라인이 부족 시 분할 라인 추가 If l2 > pageBreakCnt Then Cells(plt, 1).Select ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell &#39; 프린트 페이지 삽입 End If &#39; 최종 분할 라인 위치를 를 지정 If l2 <> totalPageCnt Then Set ActiveSheet.HPageBreaks(l2).Location = Range("A" & plt) End If Next l2 &#39; 5. 페이지 / 총 페이지 출력 dispPageRow = 10 &#39;2 &#39;Page Row(시작) dispPageCell = 9 &#39;14 &#39;Page Column For L1 = 1 To totalPageCnt Cells(dispPageRow, dispPageCell).Select pagenumber &#39;페이지 넘버 출력 dispPageRow = dispPageRow + onePageCnt Next L1 End Sub Sub R3_ITME_Sheet2() Dim r_count1 As Long &#39;Head &#39; Dim r_count2 As Long &#39;Item Dim r_count3 As Long &#39;job Order Dim r3table_1 As Object &#39; &#39; Dim r3table_2 As Object &#39; Dim r3table_3 As Object &#39; Dim onePageCnt As Long &#39;한 page의 라인 수 Dim topPageCnt As Long &#39;top page의 라인수 Dim firstTopPageCnt As Long &#39;sub top page는 첫 page일 때만 출력 Dim lastBottomPageCnt As Long &#39;마지막 page 시 사용하는 바닥글 Dim bottomPageCnt As Long &#39;바닥글 라인 수 Dim totalPageCnt As Long &#39;토탈 페이지수 Dim last_itemEndLine As Long &#39;item의 마지막 라인 Dim last_LastStaLine As Long &#39;마지막 page 시 사용하는 바닥글 시작 라인 Dim last_LastEndLine As Long &#39;마지막 page 시 사용하는 바닥글 마지막 라인 Set r3table_1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table &#39; Set r3table_2 = ThisWorkbook.Container.LinkServer.Items("ITEM").Table Set r3table_3 = ThisWorkbook.Container.LinkServer.Items("ZJOB").Table r_count1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table.RowCount &#39; r_count2 = ThisWorkbook.Container.LinkServer.Items("ITEM").Table.RowCount r_count3 = ThisWorkbook.Container.LinkServer.Items("ZJOB").Table.RowCount &#39; 0. (중복으로 출력할) 해더&바텀 DATA 미리 입력 하기 ThisWorkbook.Sheets(3).Cells(6, 2) = r3table_1.Value(1, 1) &#39;Order From ThisWorkbook.Sheets(3).Cells(6, 6) = r3table_1.Value(1, 2) &#39;Deliver To ThisWorkbook.Sheets(3).Cells(7, 11) = r3table_1.Value(1, 3) &#39;PO ThisWorkbook.Sheets(3).Cells(8, 11) = r3table_1.Value(1, 4) &#39;Date &#39;ThisWorkbook.Sheets(3).Cells(7, 10) = r3table_1.Value(1, 5) &#39;JO &#39;ThisWorkbook.Sheets(3).Cells(9, 12) = r3table_1.Value(1, 6) &#39;Page &#39; ThisWorkbook.Sheets(3).Cells(12, 3) = r3table_1.Value(1, 7) &#39;Phone &#39; ThisWorkbook.Sheets(3).Cells(13, 3) = r3table_1.Value(1, 8) &#39;Email &#39; ThisWorkbook.Sheets(3).Cells(11, 11) = r3table_1.Value(1, 9) &#39;Service Client &#39; ThisWorkbook.Sheets(3).Cells(12, 11) = r3table_1.Value(1, 10) &#39;Client Reference1 &#39; ThisWorkbook.Sheets(3).Cells(13, 11) = r3table_1.Value(1, 11) &#39;Client Reference2 &#39; ThisWorkbook.Sheets(3).Cells(14, 11) = r3table_1.Value(1, 12) &#39;Client Reference3 &#39; ThisWorkbook.Sheets(3).Cells(17, 2) = r3table_1.Value(1, 13) &#39;Delivery Date &#39; ThisWorkbook.Sheets(3).Cells(17, 5) = r3table_1.Value(1, 14) &#39;Payment Term &#39; ThisWorkbook.Sheets(3).Cells(17, 7) = r3table_1.Value(1, 15) &#39;Currency &#39; ThisWorkbook.Sheets(3).Cells(17, 10) = r3table_1.Value(1, 16) &#39;Exchange Rate &#39; ThisWorkbook.Sheets(3).Cells(39, 4) = r3table_1.Value(1, 17) &#39;Workflow Status &#39; ThisWorkbook.Sheets(3).Cells(41, 4) = r3table_1.Value(1, 18) &#39;Requested by &#39; ThisWorkbook.Sheets(3).Cells(42, 4) = r3table_1.Value(1, 19) &#39;Approved by &#39; Total &#39; ThisWorkbook.Sheets(3).Cells(38, 13) = r3table_1.Value(1, 20) &#39;Lines subtotal &#39; ThisWorkbook.Sheets(3).Cells(39, 13) = r3table_1.Value(1, 21) &#39;Tax(GST/VAT etc) &#39; ThisWorkbook.Sheets(3).Cells(41, 12) = r3table_1.Value(1, 15) &#39;Currency &#39; ThisWorkbook.Sheets(3).Cells(41, 13) = r3table_1.Value(1, 22) &#39;Total &#39; SK Adress 바닥들 &#39; ThisWorkbook.Sheets(3).Cells(48, 1) = r3table_1.Value(1, 23) &#39;Detail &#39; ThisWorkbook.Sheets(3).Cells(49, 1) = r3table_1.Value(1, 24) &#39;Detail &#39; ThisWorkbook.Sheets(3).Cells(50, 1) = r3table_1.Value(1, 25) &#39;Detail &#39; 0. Area 라인 onePageCnt = 62 &#39; 한 page의 라인 수 topPageCnt = 11 &#39;top page의 라인수 firstTopPageCnt = 0 &#39; sub top page는 첫 page일 때만 출력 lastBottomPageCnt = 0 &#39;마지막 page 시 사용하는 바닥글 bottomPageCnt = 9 &#39;바닥글 라인 수 dispCell = "M" &#39;출력마지막 CELL &#39; 1. 총 페이지수를 계산 하기 &#39;r_count2 = 52 &#39;item의 라인수 &#39;1. 첫페이지만 있을 경우의 item 가능 라인수 lv_cnt_1 = onePageCnt - topPageCnt - firstTopPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;2. 첫페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_2 = onePageCnt - topPageCnt - firstTopPageCnt - bottomPageCnt - 1 &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_3 = onePageCnt - topPageCnt - bottomPageCnt - 1 &#39;4. 2번째 페이지가 마지막 페이지 일 경우 item 가능 라인수 lv_cnt_4 = onePageCnt - topPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;--- 1. 1페이지에 넣을 수 있는지 확인 lv_v1 = r_count3 - lv_cnt_1 If lv_v1 > 0 Then &#39;--- 2. 2페이지에 넣을 수 있는지 확인 lv_v2 = r_count3 - lv_cnt_2 - lv_cnt_4 If lv_v2 > 0 Then lv_d1 = lv_v2 \ lv_cnt_3 lv_f1 = lv_v2 Mod lv_cnt_3 If lv_f1 > 0 Then totalPageCnt = lv_d1 + 3 Else totalPageCnt = lv_d1 + 2 End If Else totalPageCnt = 2 End If Else totalPageCnt = 1 End If &#39; 2. 페이지 copy and paste &#39;1. copy and set startRow = 1 endRow = onePageCnt activRow = 1 endRow8 = endRow - 7 ThisWorkbook.Sheets(3).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT If totalPageCnt > 1 Then &#39; 첫 페이지를 copy Range("A" & startRow & ":" & "M" & endRow).Select Selection.Copy For lv_1 = 1 To totalPageCnt - 1 activRow = activRow + onePageCnt Cells(activRow, 1).Select ActiveSheet.Paste startRow = startRow + onePageCnt endRow = endRow + onePageCnt endRow9 = endRow - bottomPageCnt - 1 Rows(endRow9 & ":" & endRow).Select Selection.RowHeight = 12.5 endRow8 = endRow9 + 3 ThisWorkbook.Sheets(3).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT Next lv_1 &#39;2. 2번째 페이지의 firstTopPage를 삭제 If firstTopPageCnt > 0 Then firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 1 itemendRow = itemstartRow + firstTopPageCnt - 1 itemstartRow_V2 = itemstartRow + 1 itemendRow_V2 = itemstartRow_V2 + 1 For lv_1 = 1 To totalPageCnt If lv_1 > 1 Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = firstTopstartRow Cells(activRow, 1).Select ActiveSheet.Paste Range("A" & itemstartRow_V2 & ":" & "M" & itemendRow_V2).Select Selection.Copy activRow = itemstartRow Cells(activRow, 1).Select ActiveSheet.Paste End If firstTopstartRow = firstTopstartRow + onePageCnt firstTopendRow = firstTopendRow + onePageCnt itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt itemstartRow_V2 = itemstartRow_V2 + onePageCnt itemendRow_V2 = itemendRow_V2 + onePageCnt Next lv_1 End If &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 lastBottomPage를 삭제 If lastBottomPageCnt > 0 Then lastBottomstartRow = onePageCnt - bottomPageCnt - lastBottomPageCnt + 1 lastBottomendRow = lastBottomstartRow + firstTopPageCnt - 1 itemstartRow = lastBottomstartRow - lastBottomPageCnt - 1 itemendRow = itemstartRow + lastBottomPageCnt For lv_1 = 1 To totalPageCnt If lv_1 <> totalPageCnt Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = itemendRow Cells(activRow, 1).Select ActiveSheet.Paste End If lastBottomstartRow = lastBottomstartRow + onePageCnt lastBottomendRow = lastBottomendRow + onePageCnt itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt Next lv_1 &#39; 최종 sub 바닥글의 위치 정보 last_LastStaLine = lastBottomstartRow - onePageCnt last_LastEndLine = lastBottomendRow - onePageCnt - 1 End If Else lastBottomstartRow = onePageCnt - bottomPageCnt - lastBottomPageCnt + 1 lastBottomendRow = lastBottomstartRow + firstTopPageCnt - 1 last_LastStaLine = lastBottomstartRow last_LastEndLine = lastBottomendRow - 1 End If &#39; 3. item data 출력 하기 firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 2 currPage = 1 For itemLine = 1 To r_count3 pageLine = pageLine + 1 If currPage = 1 Then &#39;첫 페이지 If totalPageCnt = currPage Then If pageLine > lv_cnt_1 Then &#39;첫 페이지가 마지막 페이지가 일 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If Else If pageLine > lv_cnt_2 Then &#39;첫 페이지가 마지막 페이지가 아닐 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If ElseIf totalPageCnt = currPage Then &#39; 마지막 페이지 Else &#39; 기타 페이지 If pageLine > lv_cnt_3 Then pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If &#39;==========> 여기서 item을 출력 하면 됩니다. ==========< Range("H" & itemstartRow & ":" & "J" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("K" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("A" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlLeft ThisWorkbook.Sheets(3).Cells(itemstartRow, 2) = r3table_3.Value(itemLine, 1) &#39; ThisWorkbook.Sheets(3).Cells(itemstartRow, 3) = r3table_3.Value(itemLine, 2) &#39; ThisWorkbook.Sheets(3).Cells(itemstartRow, 5) = r3table_3.Value(itemLine, 3) &#39; ThisWorkbook.Sheets(3).Cells(itemstartRow, 7) = r3table_3.Value(itemLine, 4) &#39; ThisWorkbook.Sheets(3).Cells(itemstartRow, 8) = r3table_3.Value(itemLine, 5) &#39; ThisWorkbook.Sheets(3).Cells(itemstartRow, 11) = r3table_3.Value(itemLine, 6) &#39; itemstartRow = itemstartRow + 1 Next itemLine &#39; 3. last 바닥글의 위치를 조정 하기 &#39; item의 마지막 라인 &#39; itemEndLine = itemstartRow + 3 &#39; Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39; Selection.Copy &#39; Cells(itemEndLine, 1).Select &#39; ActiveSheet.Paste &#39;전에 있던 last 바닥글을 지우기 &#39; Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39; Selection.Clear &#39; 4. 프린트 페이지를 지정하기 Dim plt As Long Dim pageBreakCntV2 As Long Dim hpPlt As Long plt = totalPageCnt * onePageCnt &#39;최종 페이지 라인 &#39; 4-1 최종 페이지 지정 ThisWorkbook.Sheets(3).PageSetup.PrintArea = "A1:" & dispCell & plt &#39;최종 페이지의 프린트 영역지정 &#39; 4-2 페이지 분할 개수 pageBreakCntV2 = ThisWorkbook.Sheets(3).HPageBreaks.Count &#39; 4-3 페이지 분할 위치 지정 하기 For hpact = 1 To pageBreakCntV2 &#39; 분할 페이지 이치 page_line = onePageCnt * hpact hpPlt = page_line + 1 &#39; -1 프린트 페이지 수 &#39; 분할 페이지 라인이 부족 시 분할 라인 추가 If hpact > pageBreakCntV2 Then ThisWorkbook.Sheets(3).Cells(hpPlt, 1).Select ThisWorkbook.Sheets(3).HPageBreaks.Add Before:=ActiveCell &#39; 프린트 페이지 삽입 End If &#39; 최종 분할 라인 위치를 를 지정 If hpact <> totalPageCnt Then Application.ScreenUpdating = False ActiveWindow.View = xlPageBreakPreview Set ActiveSheet.HPageBreaks(hpact).Location = Range("A" & hpPlt) ActiveWindow.View = xlNormalView Application.ScreenUpdating = True &#39;Set ThisWorkbook.Sheets(3).HPageBreaks(hpact).Location = ThisWorkbook.Sheets(3).Range("A" & hpPlt) End If Next hpact &#39; 5. 페이지 / 총 페이지 출력 dispPageRow = 10 &#39;2 &#39;Page Row(시작) dispPageCell = 9 &#39;14 &#39;Page Column For L1 = 1 To totalPageCnt Cells(dispPageRow, dispPageCell).Select pagenumber &#39;페이지 넘버 출력 dispPageRow = dispPageRow + onePageCnt Next L1 End Sub Sub R3_ITME_Sheet3() Dim r_count1 As Long &#39;Head Dim r_count4 As Long &#39;job Order Sum Dim r3table_1 As Object &#39; Dim r3table_4 As Object &#39; Dim onePageCnt As Long &#39;한 page의 라인 수 Dim topPageCnt As Long &#39;top page의 라인수 Dim firstTopPageCnt As Long &#39;sub top page는 첫 page일 때만 출력 Dim lastBottomPageCnt As Long &#39;마지막 page 시 사용하는 바닥글 Dim bottomPageCnt As Long &#39;바닥글 라인 수 Dim totalPageCnt As Long &#39;토탈 페이지수 Dim last_itemEndLine As Long &#39;item의 마지막 라인 Dim last_LastStaLine As Long &#39;마지막 page 시 사용하는 바닥글 시작 라인 Dim last_LastEndLine As Long &#39;마지막 page 시 사용하는 바닥글 마지막 라인 Set r3table_1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table Set r3table_4 = ThisWorkbook.Container.LinkServer.Items("ZSUM").Table r_count1 = ThisWorkbook.Container.LinkServer.Items("HEAD").Table.RowCount r_count4 = ThisWorkbook.Container.LinkServer.Items("ZSUM").Table.RowCount &#39; 0. (중복으로 출력할) 해더&바텀 DATA 미리 입력 하기 ThisWorkbook.Sheets(4).Cells(6, 2) = r3table_1.Value(1, 1) &#39;Order From ThisWorkbook.Sheets(4).Cells(6, 6) = r3table_1.Value(1, 2) &#39;Deliver To ThisWorkbook.Sheets(4).Cells(7, 11) = r3table_1.Value(1, 3) &#39;PO ThisWorkbook.Sheets(4).Cells(8, 11) = r3table_1.Value(1, 4) &#39;Date &#39;ThisWorkbook.Sheets(4).Cells(7, 10) = r3table_1.Value(1, 5) &#39;JO &#39;ThisWorkbook.Sheets(4).Cells(9, 12) = r3table_1.Value(1, 6) &#39;Page &#39; ThisWorkbook.Sheets(4).Cells(12, 3) = r3table_1.Value(1, 7) &#39;Phone &#39; ThisWorkbook.Sheets(4).Cells(13, 3) = r3table_1.Value(1, 8) &#39;Email &#39; ThisWorkbook.Sheets(4).Cells(11, 11) = r3table_1.Value(1, 9) &#39;Service Client &#39; ThisWorkbook.Sheets(4).Cells(12, 11) = r3table_1.Value(1, 10) &#39;Client Reference1 &#39; ThisWorkbook.Sheets(4).Cells(13, 11) = r3table_1.Value(1, 11) &#39;Client Reference2 &#39; ThisWorkbook.Sheets(4).Cells(14, 11) = r3table_1.Value(1, 12) &#39;Client Reference3 &#39; ThisWorkbook.Sheets(4).Cells(17, 2) = r3table_1.Value(1, 13) &#39;Delivery Date &#39; ThisWorkbook.Sheets(4).Cells(17, 5) = r3table_1.Value(1, 14) &#39;Payment Term &#39; ThisWorkbook.Sheets(4).Cells(17, 7) = r3table_1.Value(1, 15) &#39;Currency &#39; ThisWorkbook.Sheets(4).Cells(17, 10) = r3table_1.Value(1, 16) &#39;Exchange Rate &#39; ThisWorkbook.Sheets(4).Cells(39, 4) = r3table_1.Value(1, 17) &#39;Workflow Status &#39; ThisWorkbook.Sheets(4).Cells(41, 4) = r3table_1.Value(1, 18) &#39;Requested by &#39; ThisWorkbook.Sheets(4).Cells(42, 4) = r3table_1.Value(1, 19) &#39;Approved by &#39; Total &#39; ThisWorkbook.Sheets(4).Cells(38, 13) = r3table_1.Value(1, 20) &#39;Lines subtotal &#39; ThisWorkbook.Sheets(4).Cells(39, 13) = r3table_1.Value(1, 21) &#39;Tax(GST/VAT etc) &#39; ThisWorkbook.Sheets(4).Cells(41, 12) = r3table_1.Value(1, 15) &#39;Currency &#39; ThisWorkbook.Sheets(4).Cells(41, 13) = r3table_1.Value(1, 22) &#39;Total &#39; SK Adress 바닥들 &#39; ThisWorkbook.Sheets(4).Cells(48, 1) = r3table_1.Value(1, 23) &#39;Detail &#39; ThisWorkbook.Sheets(4).Cells(49, 1) = r3table_1.Value(1, 24) &#39;Detail &#39; ThisWorkbook.Sheets(4).Cells(50, 1) = r3table_1.Value(1, 25) &#39;Detail &#39; 0. Area 라인 onePageCnt = 62 &#39; 한 page의 라인 수 topPageCnt = 11 &#39;top page의 라인수 firstTopPageCnt = 0 &#39; sub top page는 첫 page일 때만 출력 lastBottomPageCnt = 0 &#39;마지막 page 시 사용하는 바닥글 bottomPageCnt = 9 &#39;바닥글 라인 수 dispCell = "M" &#39;출력마지막 CELL &#39; 1. 총 페이지수를 계산 하기 &#39;r_count2 = 52 &#39;item의 라인수 &#39;1. 첫페이지만 있을 경우의 item 가능 라인수 lv_cnt_1 = onePageCnt - topPageCnt - firstTopPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;2. 첫페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_2 = onePageCnt - topPageCnt - firstTopPageCnt - bottomPageCnt - 1 &#39;3. 2번째 페이지가 마지막 페이지 아닐 경우 item 가능 라인수 lv_cnt_3 = onePageCnt - topPageCnt - bottomPageCnt - 1 &#39;4. 2번째 페이지가 마지막 페이지 일 경우 item 가능 라인수 lv_cnt_4 = onePageCnt - topPageCnt - lastBottomPageCnt - bottomPageCnt - 1 &#39;--- 1. 1페이지에 넣을 수 있는지 확인 lv_v1 = r_count4 - lv_cnt_1 If lv_v1 > 0 Then &#39;--- 2. 2페이지에 넣을 수 있는지 확인 lv_v2 = r_count4 - lv_cnt_2 - lv_cnt_4 If lv_v2 > 0 Then lv_d1 = lv_v2 \ lv_cnt_3 lv_f1 = lv_v2 Mod lv_cnt_3 If lv_f1 > 0 Then totalPageCnt = lv_d1 + 3 Else totalPageCnt = lv_d1 + 2 End If Else totalPageCnt = 2 End If Else totalPageCnt = 1 End If &#39; 2. 페이지 copy and paste &#39;1. copy and set startRow = 1 endRow = onePageCnt activRow = 1 endRow8 = endRow - 7 ThisWorkbook.Sheets(4).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT If totalPageCnt > 1 Then &#39; 첫 페이지를 copy Range("A" & startRow & ":" & "M" & endRow).Select Selection.Copy For lv_1 = 1 To totalPageCnt - 1 activRow = activRow + onePageCnt Cells(activRow, 1).Select ActiveSheet.Paste startRow = startRow + onePageCnt endRow = endRow + onePageCnt endRow9 = endRow - bottomPageCnt - 1 Rows(endRow9 & ":" & endRow).Select Selection.RowHeight = 12.5 endRow8 = endRow9 + 3 ThisWorkbook.Sheets(4).Cells(endRow8, 2) = r3table_1.Value(1, 23) &#39;BUTXT Next lv_1 &#39;2. 2번째 페이지의 firstTopPage를 삭제 If firstTopPageCnt > 0 Then firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 1 itemendRow = itemstartRow + firstTopPageCnt - 1 itemstartRow_V2 = itemstartRow + 1 itemendRow_V2 = itemstartRow_V2 + 1 For lv_1 = 1 To totalPageCnt If lv_1 > 1 Then Range("A" & itemstartRow & ":" & "M" & itemendRow).Select Selection.Copy activRow = firstTopstartRow Cells(activRow, 1).Select ActiveSheet.Paste Range("A" & itemstartRow_V2 & ":" & "M" & itemendRow_V2).Select Selection.Copy activRow = itemstartRow Cells(activRow, 1).Select ActiveSheet.Paste End If firstTopstartRow = firstTopstartRow + onePageCnt firstTopendRow = firstTopendRow + onePageCnt itemstartRow = itemstartRow + onePageCnt itemendRow = itemendRow + onePageCnt itemstartRow_V2 = itemstartRow_V2 + onePageCnt itemendRow_V2 = itemendRow_V2 + onePageCnt Next lv_1 End If &#39; 3. item data 출력 하기 firstTopstartRow = 1 + topPageCnt firstTopendRow = firstTopstartRow + firstTopPageCnt - 1 itemstartRow = firstTopendRow + 2 currPage = 1 For itemLine = 1 To r_count4 pageLine = pageLine + 1 If currPage = 1 Then &#39;첫 페이지 If totalPageCnt = currPage Then If pageLine > lv_cnt_1 Then &#39;첫 페이지가 마지막 페이지가 일 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If Else If pageLine > lv_cnt_2 Then &#39;첫 페이지가 마지막 페이지가 아닐 경우 pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If ElseIf totalPageCnt = currPage Then &#39; 마지막 페이지 Else &#39; 기타 페이지 If pageLine > lv_cnt_3 Then pageLine = 1 currPage = currPage + 1 itemstartRow = itemstartRow + bottomPageCnt + topPageCnt + 1 End If End If &#39;==========> 여기서 item을 출력 하면 됩니다. ==========< Range("D" & itemstartRow & ":" & "G" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("H" & itemstartRow & ":" & "K" & itemstartRow).Select Selection.Merge &#39;2,3,4cell을 cell병합처리 하기 Range("A" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlLeft Range("H" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.HorizontalAlignment = xlRight ThisWorkbook.Sheets(4).Cells(itemstartRow, 2) = r3table_4.Value(itemLine, 1) &#39; ThisWorkbook.Sheets(4).Cells(itemstartRow, 4) = r3table_4.Value(itemLine, 2) &#39; ThisWorkbook.Sheets(4).Cells(itemstartRow, 8) = r3table_4.Value(itemLine, 3) &#39; &#39;ThisWorkbook.Sheets(4).Cells(itemstartRow, 9) = r3table_4.Value(itemLine, 4) &#39; ThisWorkbook.Sheets(4).Cells(itemstartRow, 13) = r3table_4.Value(itemLine, 5) &#39; Range("H" & itemstartRow & ":" & "M" & itemstartRow).Select Selection.NumberFormatLocal = "#,##0.00" itemstartRow = itemstartRow + 1 Next itemLine &#39; 3. last 바닥글의 위치를 조정 하기 &#39; item의 마지막 라인 &#39; itemEndLine = itemstartRow + 3 &#39; Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39; Selection.Copy &#39; Cells(itemEndLine, 1).Select &#39; ActiveSheet.Paste &#39;전에 있던 last 바닥글을 지우기 &#39; Range("A" & last_LastStaLine & ":" & "M" & last_LastEndLine).Select &#39; Selection.Clear &#39; 4. 프린트 페이지를 지정하기 Dim plt As Long Dim pageBreakCntV2 As Long Dim hpPlt As Long plt = totalPageCnt * onePageCnt &#39;최종 페이지 라인 &#39; 4-1 최종 페이지 지정 ThisWorkbook.Sheets(4).PageSetup.PrintArea = "A1:" & dispCell & plt &#39;최종 페이지의 프린트 영역지정 &#39; 4-2 페이지 분할 개수 pageBreakCntV2 = ThisWorkbook.Sheets(4).HPageBreaks.Count &#39; 4-3 페이지 분할 위치 지정 하기 For hpact = 1 To pageBreakCntV2 &#39; 분할 페이지 이치 page_line = onePageCnt * hpact hpPlt = page_line + 1 &#39; -1 프린트 페이지 수 &#39; 분할 페이지 라인이 부족 시 분할 라인 추가 If hpact > pageBreakCntV2 Then ThisWorkbook.Sheets(4).Cells(hpPlt, 1).Select ThisWorkbook.Sheets(4).HPageBreaks.Add Before:=ActiveCell &#39; 프린트 페이지 삽입 End If &#39; 최종 분할 라인 위치를 를 지정 If hpact <> totalPageCnt Then Application.ScreenUpdating = False ActiveWindow.View = xlPageBreakPreview Set ActiveSheet.HPageBreaks(hpact).Location = Range("A" & hpPlt) ActiveWindow.View = xlNormalView Application.ScreenUpdating = True &#39;Set ThisWorkbook.Sheets(4).HPageBreaks(hpact).Location = ThisWorkbook.Sheets(4).Range("A" & hpPlt) End If Next hpact &#39; 5. 페이지 / 총 페이지 출력 dispPageRow = 10 &#39;2 &#39;Page Row(시작) dispPageCell = 9 &#39;14 &#39;Page Column For L1 = 1 To totalPageCnt Cells(dispPageRow, dispPageCell).Select pagenumber &#39;페이지 넘버 출력 dispPageRow = dispPageRow + onePageCnt Next L1 If r3table_1.Value(1, 27) <> "" Then &#39;PDF Check ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ r3table_1.Value(1, 27), Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ True ThisWorkbook.Close SaveChanges:=False End If End Sub Sub pagenumber() Dim xVPC As Integer Dim xHPC As Integer Dim xVPB As VPageBreak Dim xHPB As HPageBreak Dim xNumPage As Integer xHPC = 1 xVPC = 1 If ActiveSheet.PageSetup.Order = xlDownThenOver Then xHPC = ActiveSheet.HPageBreaks.Count + 1 Else xVPC = ActiveSheet.VPageBreaks.Count + 1 End If xNumPage = 1 For Each xVPB In ActiveSheet.VPageBreaks If xVPB.Location.Column > ActiveCell.Column Then Exit For xNumPage = xNumPage + xHPC Next For Each xHPB In ActiveSheet.HPageBreaks If xHPB.Location.Row > ActiveCell.Row Then Exit For xNumPage = xNumPage + xVPC Next ActiveCell = " Page " & xNumPage & " of " & Application.ExecuteExcel4Macro("GET.DOCUMENT(50)") End Sub 帮我优化代码
05-14
문제 설명 당신은 비밀 조직의 보안 시스템을 뚫고 중요한 정보를 해독해야 합니다. 시스템은 1부터 까지의 서로 다른 정수 5개가 오름차순으로 정렬된 비밀 코드를 가지고 있으며, 당신은 이 비밀 코드를 맞혀야 합니다. n 당신은 비밀 코드를 알아내기 위해 암호 분석 도구를 사용하며, 번의 시도를 할 수 있습니다. 각 시도마다 서로 다른 5개의 정수를 입력하면, 시스템은 그 중 몇 개가 비밀 코드에 포함되어 있는지 알려줍니다.m 만약 비밀 코드가 [3, 5, 7, 9, 10]이고, 입력한 정수가 [1, 2, 3, 4, 5]라면 비밀 코드에 포함된 정수는 3, 5 두 개이므로 시스템은 2를 응답합니다. 당신은 번의 시도 후, 비밀 코드로 가능한 정수 조합의 개수를 알고 싶습니다.m 비밀 코드에 사용된 정수의 범위가 1~10일 때, 아래와 같이 5번의 시도를 했다고 가정해 보겠습니다. 입력한 정수 시스템 응답(일치하는 개수) [1, 2, 3, 4, 5] 2개 [6, 7, 8, 9, 10] 3개 [3, 7, 8, 9, 10] 4개 [2, 5, 7, 9, 10] 3개 [3, 4, 5, 6, 7] 3개 비밀 코드로 가능한 정수 조합은 아래와 같이 3개가 있습니다. [3, 4, 7, 9, 10] 첫 번째 시도에서 비밀 코드에 포함된 정수가 3, 4로 2개 있습니다. 두 번째 시도에서 비밀 코드에 포함된 정수가 7, 9, 10으로 3개 있습니다. 세 번째 시도에서 비밀 코드에 포함된 정수가 3, 7, 9, 10으로 4개 있습니다. 네 번째 시도에서 비밀 코드에 포함된 정수가 7, 9, 10으로 3개 있습니다. 다섯 번째 시도에서 비밀 코드에 포함된 정수가 3, 4, 7로 3개 있습니다. [3, 5, 7, 8, 9] 첫 번째 시도에서 비밀 코드에 포함된 정수가 3, 5로 2개 있습니다. 두 번째 시도에서 비밀 코드에 포함된 정수가 7, 8, 9로 3개 있습니다. 세 번째 시도에서 비밀 코드에 포함된 정수가 3, 7, 8, 9로 4개 있습니다. 네 번째 시도에서 비밀 코드에 포함된 정수가 5, 7, 9로 3개 있습니다. 다섯 번째 시도에서 비밀 코드에 포함된 정수가 3, 5, 7로 3개 있습니다. [3, 5, 7, 8, 10] 첫 번째 시도에서 비밀 코드에 포함된 정수가 3, 5로 2개 있습니다. 두 번째 시도에서 비밀 코드에 포함된 정수가 7, 8, 10으로 3개 있습니다. 세 번째 시도에서 비밀 코드에 포함된 정수가 3, 7, 8, 10으로 4개 있습니다. 네 번째 시도에서 비밀 코드에 포함된 정수가 5, 7, 10으로 3개 있습니다. 다섯 번째 시도에서 비밀 코드에 포함된 정수가 3, 5, 7로 3개 있습니다. 정수 , 입력한 정수를 담은 2차원 정수 배열 와 시스템 응답을 담은 1차원 정수 배열 가 매개변수로 주어집니다. 이때, 비밀 코드로 가능한 정수 조합 개수를 return 하도록 solution 함수를 완성해 주세요.nqans 제한사항 10 ≤ ≤ 30n 1 ≤ (의 길이 = ) ≤ 10 qm q[i]의 길이 = 5 q[i]는 번째 시도에서 입력한 5개의 서로 다른 정수를 담고 있으며, 오름차순으로 정렬되어 있습니다.i+1 1 ≤ ≤ q[i][j]n ans의 길이 = m ans[i]는 번째 시도에서 입력한 5개의 정수 중 비밀 코드에 포함된 정수의 개수를 나타냅니다.i+1 0 ≤ ≤ 5ans[i] 비밀 코드가 존재하지 않는(답이 0인) 경우는 주어지지 않습니다. 테스트 케이스 구성 안내 아래는 테스트 케이스 구성을 나타냅니다. 각 그룹 내의 테스트 케이스를 모두 통과하면 해당 그룹에 할당된 점수를 획득할 수 있습니다. 그룹 총점 추가 제한 사항 #1 20% m = 1 #2 80% 추가 제한 사항 없음 입출력 예 n q ans result 10 [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [3, 7, 8, 9, 10], [2, 5, 7, 9, 10], [3, 4, 5, 6, 7]] [2, 3, 4, 3, 3] 3 15 [[2, 3, 9, 12, 13], [1, 4, 6, 7, 9], [1, 2, 8, 10, 12], [6, 7, 11, 13, 15], [1, 4, 10, 11, 14]] [2, 1, 3, 0, 1] 5 입출력 예 설명 입출력 예 #1 문제 예시와 같습니다. 입출력 예 #2 비밀 코드로 가능한 정수 조합은 아래와 같이 5개가 있습니다. [1, 2, 3, 5, 8] [1, 3, 5, 8, 12] [2, 4, 5, 8, 12] [2, 5, 8, 9, 10] [5, 8, 9, 10, 12] 따라서 5를 return 해야 합니다. 用中文解答,用C语言编码
最新发布
08-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值