Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() hey, I'm kinda new at Macros and I'm not sure how to fix this error. here is my code..sorry for the lack of comments, I haven't finished them yet. when I hit 'debug' it highlights the last line before End Sub. Oh, and this doesn't happen with all the inputs, just some. Sub Copy() ' This Macros allows the user to simply select their ' Choices from a listbox and hit a button to send data to the ' appropriate worksheets. Dim Cell Dim Destination Dim Number Dim getfrom Dim Address Dim GetProg Dim GetNum Dim GetMonth Dim GetMonthLet ' this tells the macros what worksheet to send the data to getfrom = Range("F7") Number = getfrom + 6 Address = Range("C" & Number) GetProg = Range("G7") If GetProg < 17 Then DestNum = GetProg + 9 ElseIf GetProg = 17 Then DestNum = 34 ElseIf GetProg = 18 Then DestNum = 39 End If GetMonth = Range("H7") If GetMonth = 1 Then GetMonthLet = "D" ElseIf GetMonth = 2 Then GetMonthLet = "E" ElseIf GetMonth = 3 Then GetMonthLet = "F" ElseIf GetMonth = 4 Then GetMonthLet = "G" ElseIf GetMonth = 5 Then GetMonthLet = "H" ElseIf GetMonth = 6 Then GetMonthLet = "I" ElseIf GetMonth = 7 Then GetMonthLet = "J" ElseIf GetMonth = 8 Then GetMonthLet = "K" ElseIf GetMonth = 9 Then GetMonthLet = "L" ElseIf GetMonth = 10 Then GetMonthLet = "M" ElseIf GetMonth = 11 Then GetMonthLet = "N" ElseIf GetMonth = 12 Then GetMonthLet = "O" ElseIf GetMonth = 13 Then GetMonthLet = "D" ElseIf GetMonth = 14 Then GetMonthLet = "E" ElseIf GetMonth = 15 Then GetMonthLet = "F" End If Destination = Address & "!" & GetMonthLet & DestNum Range("I7").Copy Destination:=Range(Destination) End Sub -- higherlimits ------------------------------------------------------------------------ higherlimits's Profile: http://www.excelforum.com/member.php...o&userid=34841 View this thread: http://www.excelforum.com/showthread...hreadid=546062 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Nevermind, I've got the answer. -- higherlimits ------------------------------------------------------------------------ higherlimits's Profile: http://www.excelforum.com/member.php...o&userid=34841 View this thread: http://www.excelforum.com/showthread...hreadid=546062 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Sorry about posting my new thread this way, but the interface for this group hides the "New Post" link very effectively. I don't know why it isn't prominently displayed and everywhere, but that's showbiz! I always spend 15 minutes or so hunting for it before I give up in frustration. Anyway, here goes: I have the following code in an Access module: xlObj.Selection.End(xlDown).Activate xlObj.ActiveCell.Offset(0, 1).Activate strAdd3 = xlObj.ActiveCell.Address xlObj.ActiveCell.Value = "4/21/2006" Wksht.Range(strAdd1 & ":" & strAdd2).Select xlObj.Selection.AutoFill Destination:=Range(strAdd1 & ":" & strAdd3), Type:=xlFillDefault Everything runs fine until the last line, which causes the offending error msg. So, xlObj is a valid Excel application object, Wksht is a valid worksheet object, strAdd3 is a valid string (in this case "$D$181") and both the other strAdd variables are valid strings and valid addresses ("$D$2" and "$D$3", respectively), but the code chokes on that last line. All donations are gratefully accepted. Bill R -- ragtopcaddy ------------------------------------------------------------------------ ragtopcaddy's Profile: http://www.excelforum.com/member.php...o&userid=25838 View this thread: http://www.excelforum.com/showthread...hreadid=546062 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I rebooted the PC, opened the app, and ran the procedure that caused the error before. But this time - no error. I don't know why and I suppose I never will. Thanks anyway, Bill R -- ragtopcaddy ------------------------------------------------------------------------ ragtopcaddy's Profile: http://www.excelforum.com/member.php...o&userid=25838 View this thread: http://www.excelforum.com/showthread...hreadid=546062 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dynamic Range with unused formula messing up x axis on dynamic graph | Charts and Charting in Excel | |||
Using a worksheet name from a range | Excel Worksheet Functions | |||
Range object without blank cells | Excel Discussion (Misc queries) | |||
ClearContents method on a passed range | New Users to Excel | |||
Formula to list unique values | Excel Worksheet Functions |