LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Excel Prob

I am writing a routine. Excel reads a list, and based on the value in
Column H, Excel will cut-n-paste the entire row from Worksheet A to
Worksheet B, C, or even Z, based on the value found in column H.

Private Sub cmdDoParse_Click()

Dim lastrow As Integer
Dim wks As Worksheet
Dim Codes As Range
Dim i As Integer
Dim importwks As String
Dim targetwks As String
Dim codetable As Range
Dim targetrow As Integer

' first thing is to parse the number of rows on the imported data sheet

Application.ScreenUpdating = False

Sheets("Import").Select
lastrow = Range("B65536").End(xlUp).Row - 1

For i = 1 To lastrow

Range("H2").Select

importwks = Range("H2").Value

targetrow = Sheets(importwks).Range("B65536").End(xlUp).Row + 1

Range("A2").EntireRow.Cut
Destination:=(Sheets(importwks).Range(targetrow))

Next i

Application.ScreenUpdating = True

End Sub

I always get a 1004 Error when it hits the Range-EntireRow cut
statement. Importwks is the name of the target worksheet, which is
found in Column H (this comes from another table, based on a vlookup),
Targetrow is the last row used on importwks.

Clear as mud yet? TIA - Replies to the group as I no longer use this
email address.

 
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
Printing from excel prob. rakaca Excel Discussion (Misc queries) 1 June 15th 09 07:35 PM
Excel 2003 prob joachimhoneymann Excel Discussion (Misc queries) 2 April 25th 07 10:07 PM
Excel Prob.....What functions? aeiou Excel Discussion (Misc queries) 2 August 3rd 05 06:49 PM
waiting for an answer pls excel/vba prob programmer_int[_6_] Excel Programming 2 September 8th 04 01:11 AM
excel vba date format prob. jo11[_2_] Excel Programming 1 January 30th 04 07:20 PM


All times are GMT +1. The time now is 06:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"