Error Setting Range In Transcribing Macro

Oct 7, 2009

Trying to write a macro to transcribe data from columns in Sheet1 to Rows in Sheet2. Assuming there is a blank between each record. I get an error on the "Set Rng1....." line.

View 4 Replies


ADVERTISEMENT

Error Setting Range Variable

Aug 8, 2006

i have compiled a multipage using some borrowed code and some code i have written myself. most of it works, but i have a problem populating listbox2.the error is in Private subCmbFindAllJobNo_Click(). i have put h1 tags around the line of code which shows the error when i debug. this code works ok as a stand alone, so i suspect i have done something wrong in the userform initialise.

Option Explicit
Dim rng As Range
Const FirstRow As Long = 2
Dim r As Long
Dim ans As Variant
Dim MyArray(100, 4)

Public MyData As Range, c, d As Range

Private Sub cmbAmend_Click()

Application. ScreenUpdating = False
Set c = Worksheets("ENTRY SHEET").Range("b4").End(xlUp).Offset(3, 0)
c.Value = Me.DTPicker1.Value
c.Offset(1, 0).Value = Me.TextBox1.Value
c.Offset(2, 0).Value = Me.TextBox2.Value ..........

View 9 Replies View Related

Setting Range To Value Fails With 1004 Error

May 9, 2007

I'm trying to find the last row on a sheet and then set the next cell, in column A to a certain value. It fails with Method 'Range' of object '_Worksheet' failed.

'activate the male page
sMalePicks.Activate

'add to last row of male baggage
lastRow = sMalePicks.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row

'get next row
lastRow = lastRow + 1

sMalePicks.Range(Cells(lastRow, 1), Cells(lastRow, 1)) = Trim(bagNames(x))

View 5 Replies View Related

Setting A Data Range For A Chart (error 1004).

Feb 1, 2010

I'm trying to do a simple loop which creates charts based on an ID number. I recorded a macro and has tried to modify it but am having trouble defining the correct reange when settign the data source. Here is my

View 2 Replies View Related

Subscript Out Of Range - Error Relating To Setting Workbook

Jul 11, 2014

I'm trying to do the following

Dim wkb As Workbook
Dim wkb2 As Workbook

Set wkb = ActiveWorkbook
Set wkb2 = Workbooks("F:SuppliersBT Monthly Invoice2014BT Macros.xlsm")

but get a subscript out of range error relating to setting wkb2

The file BT Macros is open - this is where the Macro is stored. What have I done wrong when trying to reference it?

View 5 Replies View Related

Subcript Out Of Range Error Setting Worksheet Variable

Sep 13, 2006

Subcript Out Of Range Error Coming Now For The Code Which Works For Me Before


Sub WHideRows()

Dim rRange As Range, rCell As Range
Dim strVal As String

Set rRange = Worksheets("WIED PROBLEM WELLS").Range("A11:A110")

For Each rCell In rRange
strVal = rCell(1, 3) & rCell(1, 4) & rCell(1, 5) & rCell(1, 6) & rCell(1, 7) & rCell(1, 9)
rCell.EntireRow.Hidden = strVal = vbNullString
Next rCell

End Sub

i am using the code above to hide the rows which doesn't have any values in all the following Cells 3,4,5,6,7 & 9 or Unhide the rows if there is value in any 1 of the following cells 3,4,5,6,7 & 9 from row number A11 to A110.

The same code works for me before. But now the code is not working. It says below the error message

Run-time error '9':..................

View 9 Replies View Related

Object Required Error Setting Range Variable

Aug 22, 2007

code is getting an error on the bold line below. My error message is run time error 424 - object required.....

View 7 Replies View Related

Macro Error Setting SeriesCollection

Nov 7, 2006

I try to plot an XY graph with a VB macro but I don't manage to select the right name of the active sheet.

Sub plot()
WksName = ActiveSheet.Name
Worksheets(WksName).Activate

Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets(WksName).Range("A11:F12"), PlotBy:= _
xlRows
ActiveChart.SeriesCollection(1).XValues = "=WksName!R5C8:R643C8"
ActiveChart.SeriesCollection(1).Values = "=WksName!R5C9:R643C9"
ActiveChart.SeriesCollection(1).Name = "=""Specular"""
ActiveChart.Location Where:=xlLocationAsObject, Name:=WksName


End Sub

View 6 Replies View Related

Excel 2010 :: Setting Range - Runtime Error 1004

May 1, 2012

I am using Excel 2010. Why I do struggle with setting the range below

Code:
Set rng = Sheets("Data").Range(Cells(4, firstcol), Cells(lastrow, lastcol))

I get run time error 1004

Tried simple code from msdn and it return same error

Code:
Range(Cells(2, 3), Cells(10, 4)).Select

View 2 Replies View Related

A Macro Setting That Would Cause A Run-time Error 1004

May 6, 2009

Is there a setting within excel that could cause a user to get a run-time error 1004? I have a workbook with a macro that adds additional sheets to the workbook when a button is clicked. The thing works fine on my machine and 3 or 4 other machines that I have had guys test it out, but I have a user that it will not work for. He is at a location about 3 hours away so I cant see exactly what he is doing, but he says after he clicks the button he gets a run-time error 1004 that says "Unable to set the PrintQuality property of the Page Setup class". I'm thinking that it is a setting within excel?

View 5 Replies View Related

Setting Top Value - Error 1044

Oct 9, 2009

I am using some code to amend the top value of some autoshapes on various sheets.
I am getting a 1004 error: unable to set the top value.

This is a stripped down part of the code, this still gives me exactly the same error

Dim shName As Variant
Dim shTag As Variant
Dim buttName As Variant

Sub GraphButtNew(shName, shTag)
buttName = "B_" & shTag
Sheets(shName).Shapes(buttName & "_1_1").Select
Selection.Top = Range("A52").Top
End Sub

Variables passed to this routine are:
shname = "Sheet1"
shtag = "SH1"

i have an autoshape called "B_SH1_1_1" on Sheet1 but it wont allow me to amend the top value

View 9 Replies View Related

Error When Setting Cell Contents As String In VBA

Aug 20, 2013

The following line of code:

Range("G3").Value = "=("

is giving me the following error:

Application-defined or object defined error

however the following line of code works perfectly:

Range("G3").Value = "(="

I'm basically trying to put various different strings as cell values..

View 5 Replies View Related

Run-Time Error Setting Worksheet Variable

Aug 30, 2007

The user is asked for one piece of information "Enter the ID Number.

What the macro should do then is go to Wks1 find the ID Number and change some cells as a result. This bit works.

Set Wks2 = Worksheets(strWks)

7 rows from the bottom.

My intention was to capture the the name of another worksheet which is held on the same row as the ID Number on Wks1 and call it strWks.

Then further down the macro set the value of Wks2 to that of strWks so that the macro will then go to that sheet and remove data from the row with the same ID Number.

I get a Time Run Error 9.

It just seems to be the bit at the bottom where I am trying to identify Wks2 using strWks.

Sub Macro01C_Auto_Resign()
Dim Wks1 As Worksheet, Wks2 As Worksheet
Dim strFind As String, rngFound As Range
Dim lngRow As Long, rngUnion As Range, strWks As String ............................

View 9 Replies View Related

Invalid Qualifer Error -setting Variable Using Getpivotdata

Mar 22, 2007

We have a very long macro that at the end sends an email to each training coordinator. Within the body of the email, we want to autopopulate the completion status from a pivot table using getpivotdata.

We first try to set the variable but get an error: [compile error:invalid qualifier].

Sheets(Summary).Select
Dim BDCompletion As String
BDCompletion = Application.PivotTableSelection.GetPivotData(A3, "Business Dev Plan Found")

And this is how we plan to incorporate the variable into the body of the email:

With OutMail
.To = "name@company.com"
.CC = ""
.BCC = ""
.Subject = CurrentSheet.Name & " Training Plan Status as of " & Format(Now, "dd-mmm-yy")
.Body = "BD is " & BDCompletion & " complete for 2007 Training Plans as of the date of this email."
.Attachments.Add Destwb.FullName
'You can add other files also like this
'.Attachments.Add ("C: est.txt")
.Send 'or use .Display
End With

View 9 Replies View Related

Setting Range

Mar 15, 2007

How do you set the range with whats below? Right now its looking at 4,2 only and if extend to look all the way to 19,2 it will just copy the whole screen. I need it to look at 4,2 and then move to 5,2 and then so on once it has copied all that information to the sheet ...

View 7 Replies View Related

Setting Range For Sheet3?

Jul 2, 2014

How can i set the range for the Sheet3 i have taken IngDataColumn. It select only particular column of fixed that is 4

[Code] ....

View 14 Replies View Related

Setting Criteria In A Range

Apr 27, 2009

i would like to set a criteria bewteen a ranges. eg If A1 >0 but <100 then .3, Else If A1 >99 but <200 then .6, Else .9. How do i write this in the cell?

View 4 Replies View Related

Dynamic Range Setting

Oct 22, 2009

This should be easy ... can't figure it out. If I want a formula that wants to perform an action (NPV, but I don't think that matters) on the cell directly above and the next "X" (say 20 cells/years of cash flow) to the right of it, how can I set it up so that I can copy the formula across as well as change "X".

(Obviously, it's easy to select a 20 cell range and copy it across ... but what if I want the length of the range to by dynamic (ie I want to switch to a 40 year NPV instead of a 20 year)?)

View 2 Replies View Related

Setting Range For Array

Oct 16, 2012

I am trying to set an Array to prompt user with a series of questions and input answers into a specific row. However, I want to skip over certain columns and leave those blank. How would I modify my code to do this?

Code:

Private Sub CommandButton2_Click()
Dim ArrQues() As Variant
Dim ArrInput(2) As Variant
Dim lngLstRow As Long
Dim strPNfromSales As String
ArrQues = Array("Enter the Part Number.", _ "Quantity Being Returned?", _ "What is the Reason for Rejection?")
For b = LBound(ArrQues) To UBound

[Code]...

I want the first two questions to be input into Column B & C, but then the third question to be input into column I.

View 2 Replies View Related

Setting VBA Code Range

Sep 27, 2009

When I'm using the Macro recorder or even after I've completed a sequence is there a way to change the range so it code always covers the complete range of the data?

View 9 Replies View Related

Setting Date Range For Chart?

Feb 3, 2014

I have a general list from which a chart is created. Column one contains a date series. There are a fixed number of dates in this series (approx 50 or so).

I would like to select a start date and an end date from this list and have the chart display the data from that range.

Typically I would simply create a new list and build the chart from the list, but I'm kind of hoping that I could do it from a single source rather than make mulitple lists.

View 2 Replies View Related

Setting Variable As Data Range?

Dec 12, 2011


I am attempting to set a variable as a range of data that sits on a non-activated worksheet. However, I am getting a runtime error of 13 (data mismatch).

Is there something in my code that may be incorrect? Here is my code:

Dim rRange As Range
Dim sRange As String
Dim tblName As String

[Code]......

View 4 Replies View Related

Setting Worksheets - Subscript Out Of Range

Feb 29, 2012

Code:
Private Sub Worksheet_Activate()

On Error Resume Next
Set sT = Sheets("Report")
On Error GoTo 0
On Error GoTo nendR
If Not sT Is Nothing Then

[Code] ........

I get a Subscript out of range at Set cT = Sheets("RGA by Customer") line.

It baffles me that when neither sheet exists and the first part runs there is no problem, but when it gets the the above mentioned line I get this error. Same exact code, just a different sheet name.

Again, when the sheet exists there is no problem. Only when I click on Sheet1 (or start up the file) and this sheet doesn't exist do I get the error.

View 4 Replies View Related

Using Named Ranges When Setting Range In VBA?

Oct 13, 2013

Im trying to set a range using a named range and dont know the best way to do this. so far ive got

Set rDataRange = Range(Offset("datastart",1, 0) & ":" & Offset("datastart",LastRow, 0))

datastart is the named range in the sheet and im trying to make a new range that starts 1 row below where datastart is and end where lastrow is. not sure where i messed up on this but i get errors when i try to run this

View 3 Replies View Related

Setting A Range Using String Variable

Jan 8, 2014

I'm having trouble setting the Range "UtilizationRange" using a variable, "CurrentRange" to store that range. I get the error "Run-Time error 1004: Method 'Range' of object'_Global' failed".The rest of my code works when I set the utilization range using the actual range for my purposes, but the problem is the range will change each month and I don't want to change it manually each time. There's a cell in the excel sheet this refers to (AG3) that holds the range value, which in this case is [N7:N75], and I would just like to return that value to the variable "CurrentRange" and set UtilizationRange equal to that.

The value is returned to CurrentRange, but it's the last line that's giving me the problem.

Sub RangeTest()Dim UtilizationRange As Range, Cell As RangeDim CurrentRange As String
CurrentRange = Range("AG3").Value MsgBox (CurrentRange)
'This returns the value [N7:N75], which is what I want
Set UtilizationRange = Range("CurrentRange")End Sub

View 1 Replies View Related

Inefficient Setting Of Range Properties

Mar 17, 2008

This is the code that Recorder proffers to simply take a Range of 3 Cells and make Type Font Black/Bold and to place Thin Borders inside the range and Thick Borders aroung the range.

ActiveCell.Offset(0, -2).Range("A1:C1").Select
Selection.Font.ColorIndex = 1
Selection.Font.Bold = True
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With

View 9 Replies View Related

Setting A Range Of Fill Dates

Jun 23, 2006

I have a certain number of accounts for opening and close dates. What I wish to acheive is to fill a Range of date from the opening to the closing (or up to 200606 YYYY-MM) in another spreadsheet with the account number corresponding to that date next to it.

The VBA I have right now manages to create the list of accounts but up till 2006. It isnt taking into consideration the closing dates of accounts.

So For example What I want is to set up inside of the loop that to continue to do the loop until it reaches the closing date by YYYY-MM so if the clossing date is 200504 I will have data filled up to that date, and if the closing date is "" then fill the dates up til 200606. Ive tried out a number of ways of inserting the if statement but apparently the string create a problem.

Here is my current VBA and a Sample Sheet of what it looks like....

View 9 Replies View Related

Using FIND Command And Setting RANGE

Jun 24, 2006

I m trying to set a range on a cell after using the FIND function in a macro and was wondering if anyone had any experience in it.

Basically, I have a spreadsheet which I am looking up a value that i stored in FID1 with the extension "_EXE"

I'm using the FIND command to find that cell and then set a range so that I can mark it but am getting an error....

View 8 Replies View Related

Setting Range Returns Type Mismatch?

Jul 6, 2013

I have a bit of code that builds a formula and uses a variable store the range:

VB:
Sheets("CONTROL").Select
lastRow = Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

[Code].....

View 5 Replies View Related

Setting Range Of Numbers And Performing Subtraction?

Mar 28, 2014

I am creating a range of numbers from 1 to 2000 with increments of 0.5. Then I have to subtract certain range, for example, 100 to 350. So, the result should display, 1 to 95.5 and 350.5 to 2000.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved