Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2014, 11:59 PM
Authorized User
 
Join Date: Nov 2014
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Passing varibles inside a Range function

Hi,

I wanted to copy 4 columns from data in 4th row to data in last row.
I am trying to write the following code, but it isnt working.
Kindly suggest the way to do it.

Code:
Sub Copy()
Dim spendSheet As Worksheet
Sheets("Raw").Select
Set raw = ThisWorkbook.Sheets("Raw")

lastrow = raw.UsedRange.Rows.Count

 
    'select column 1 A1'

Range("A:A" & lastrow,"D:D" & lastrow , "E:E" & lastrow,"I:I" & lastrow).Select
I dont want to use Range("A:A, D:D, E:E, I:I"), because it uses unnecessary data.
 
Old November 5th, 2014, 07:05 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

Can you try the following

http://stackoverflow.com/questions/2...-new-worksheet

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
If Else Condition not working inside the submittButton_Click function/method skhan ASP.NET 3.5 Professionals 4 August 26th, 2009 04:21 PM
TRANSLATE FUNCTION INSIDE XPATH pallone XSLT 8 February 8th, 2008 05:30 PM
cannot 'seek' inside a function dextermagnific XSLT 2 August 10th, 2006 01:54 AM
How to call normal "write" function inside a class jonen C++ Programming 3 May 25th, 2006 02:19 PM
use a JS-variable/function inside a tag cybermaarten Javascript 3 January 20th, 2005 05:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.