![]() |
Inserting Multiple Columns
I have two open worksheets and I'm trying to insert 3 columns into the active
one. I'm using Visual Studio 2005, and excel 2007. I have this so far. Dim r As Range Dim r2 As Range Dim r3 As Range r = ("A:CQ") <---getting an error, string can't be converted to range r(r.Columns.Count - 86).EntireColumn.Insert() r2 = ("A:CR") r2(r2.Columns.Count - 87).EntireColumn.Insert() r3 = ("A:CS") r3(r3.Columns.Count - 88).EntireColumn.Insert() Any ideas? Thanks! |
Inserting Multiple Columns
Set r = Range("A:CQ")
__________________________________________________ _______________________ "NewToVB" wrote in message ... I have two open worksheets and I'm trying to insert 3 columns into the active one. I'm using Visual Studio 2005, and excel 2007. I have this so far. Dim r As Range Dim r2 As Range Dim r3 As Range r = ("A:CQ") <---getting an error, string can't be converted to range r(r.Columns.Count - 86).EntireColumn.Insert() r2 = ("A:CR") r2(r2.Columns.Count - 87).EntireColumn.Insert() r3 = ("A:CS") r3(r3.Columns.Count - 88).EntireColumn.Insert() Any ideas? Thanks! |
Inserting Multiple Columns
Hi there. I tried that and it says "Range is an expression and cannot be
converted to string" "Vasant Nanavati" wrote: Set r = Range("A:CQ") __________________________________________________ _______________________ "NewToVB" wrote in message ... I have two open worksheets and I'm trying to insert 3 columns into the active one. I'm using Visual Studio 2005, and excel 2007. I have this so far. Dim r As Range Dim r2 As Range Dim r3 As Range r = ("A:CQ") <---getting an error, string can't be converted to range r(r.Columns.Count - 86).EntireColumn.Insert() r2 = ("A:CR") r2(r2.Columns.Count - 87).EntireColumn.Insert() r3 = ("A:CS") r3(r3.Columns.Count - 88).EntireColumn.Insert() Any ideas? Thanks! |
Inserting Multiple Columns
I don't use Visual Studio so perhaps a different syntax needs to be used.
You may need to fully qualify the range reference: Set r = Workbooks("xyz.xls").Worksheets("abc").Range("A:CQ ") __________________________________________________ _______________________ "NewToVB" wrote in message ... Hi there. I tried that and it says "Range is an expression and cannot be converted to string" "Vasant Nanavati" wrote: Set r = Range("A:CQ") __________________________________________________ _______________________ "NewToVB" wrote in message ... I have two open worksheets and I'm trying to insert 3 columns into the active one. I'm using Visual Studio 2005, and excel 2007. I have this so far. Dim r As Range Dim r2 As Range Dim r3 As Range r = ("A:CQ") <---getting an error, string can't be converted to range r(r.Columns.Count - 86).EntireColumn.Insert() r2 = ("A:CR") r2(r2.Columns.Count - 87).EntireColumn.Insert() r3 = ("A:CS") r3(r3.Columns.Count - 88).EntireColumn.Insert() Any ideas? Thanks! |
Inserting Multiple Columns
Yeah I tried that too, but it didnt' work. Well maybe this is a better
idea.... I think I can do a VLOOKUP. Because I have two workbooks both with one sheet and unique identifiers in column A. I need loop through sheet1, column A and find the matching id number in sheet 2 and add a new column with a calculation in it (the difference in column B from the old sheet and new sheet)... do you know how I would code a VLOOKUP, i'm really not sure at all. Thanks! "Vasant Nanavati" wrote: I don't use Visual Studio so perhaps a different syntax needs to be used. You may need to fully qualify the range reference: Set r = Workbooks("xyz.xls").Worksheets("abc").Range("A:CQ ") __________________________________________________ _______________________ "NewToVB" wrote in message ... Hi there. I tried that and it says "Range is an expression and cannot be converted to string" "Vasant Nanavati" wrote: Set r = Range("A:CQ") __________________________________________________ _______________________ "NewToVB" wrote in message ... I have two open worksheets and I'm trying to insert 3 columns into the active one. I'm using Visual Studio 2005, and excel 2007. I have this so far. Dim r As Range Dim r2 As Range Dim r3 As Range r = ("A:CQ") <---getting an error, string can't be converted to range r(r.Columns.Count - 86).EntireColumn.Insert() r2 = ("A:CR") r2(r2.Columns.Count - 87).EntireColumn.Insert() r3 = ("A:CS") r3(r3.Columns.Count - 88).EntireColumn.Insert() Any ideas? Thanks! |
All times are GMT +1. The time now is 01:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com