Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to store current row into variable


It seems u need to copy data from 1 file to another skipping blank an
also to paste data of next file after current row pasted.

If yes, then assign 1 cell (for e.g.: A1) in your workbook-Data t
start your current row position to paste.

Now Try this..

Code
-------------------

Sub Import_Data()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim myCopyRow, myPasteRow, i

Set ws1 = Workbooks("Collect.xls").Sheets("test") 'set sheets
Set ws2 = Workbooks("Data.xls").Sheets("data")

myCopyRow = ws1.Range("B65536").End(xlUp).Row 'store value for rng used in col-B
myPasteRow = ws2.Range("A1").Value

'Paste skipping blank
With ws1
For i = 2 To myCopyRow
If .Cells(i, 2).Value < 0 Then
ws2.Cells(myPasteRow, 2).Value = .Cells(i, 2).Value
myPasteRow = myPasteRow + 1 'increase
End If
Next i
End With

End Sub

-------------------


Do not forget to enter some value manually in workbook-data in cell-A
for first time before triggering this macro..

Cheers!!!
ilya

--
ilyaskaz
-----------------------------------------------------------------------
ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396
View this thread: http://www.excelforum.com/showthread.php?threadid=47499

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to store current row into variable


Hi,

Thank you all of you very much for your suggestion. It's work.

--
jafer

-----------------------------------------------------------------------
jafery's Profile: http://www.excelforum.com/member.php...fo&userid=2764
View this thread: http://www.excelforum.com/showthread.php?threadid=47499

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
How to store text to variable jafery Excel Programming 0 September 29th 05 10:18 AM
Store the Spreadsheets filename in a variable? Mike Hanby Excel Programming 2 March 17th 05 11:29 PM
Store variable value for Chart Al Jager Excel Programming 1 February 19th 04 10:58 AM
Use Current directory to store file Paul Moles[_2_] Excel Programming 1 November 26th 03 03:04 PM
HOW TO STORE CURRENT COLUMN & ROW tootles Excel Programming 1 October 2nd 03 10:37 PM


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