Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Help with ranges

I'm using this code to copy data from one workbook to another. If there is
data in B20:B57 I copy the data in Col A to Col B of the new WB and the Data
in Col B goes to Col c in the new WB.. Now I need to add another range to
it and I just can't get it to work. I've tried putting it before the copy and
even in a new sub, but it just isn't working. Now I need to copy the data
based on Col G20:G57. If there is data there I need to copy the data in col F
to Col B of the new WB and the Data in Col G to Col C. I appreciate your
help thanks.

Sub TodaySide()
Dim rng As Range, rng1 As Range, rng2 As Range
Dim rng3 As Range

With Worksheets("Data Input")

Set rng = .Range("B20:B57").SpecialCells(xlConstants, xlNumbers)

Set rng1 = Intersect(rng.EntireRow, .Columns(1))
Set rng2 = Intersect(rng.EntireRow, .Columns(2))

If Not rng Is Nothing Then

Else
Exit Sub
End If
End With

Dim bk As Workbook
Set bk = Workbooks.Open("C:\test\test.xls")


Set rng3 = bk.Worksheets("Pending").Cells(Rows.Count, 2).End(xlUp)(2)

rng1.Copy rng3.Offset(0, 0)

With Selection
.HorizontalAlignment = xlLeft
.Interior.ColorIndex = xlNone
End With

With Selection.Font
.Name = "Arial"
.Size = 9
.Bold = False
.ColorIndex = 0
End With

rng2.Copy rng3.Offset(0, 1)

With Selection
.Interior.ColorIndex = xlNone
End With

End Sub




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 copy formula that contains ranges so ranges do not overlap Patty Excel Worksheet Functions 1 November 20th 08 04:15 PM
union of named ranges based only on the names of those ranges sloth Excel Programming 3 October 2nd 06 03:18 AM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM
Counting variable ranges and auto-summing variable ranges Father Guido[_5_] Excel Programming 2 March 29th 06 04:07 AM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM


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