-
Feb 29th, 2012, 04:28 PM
#1
Thread Starter
New Member
Please Help!!.
I have written some VB code to select a named range, copy it open another workbook and paste (special values) into it - starting at the first blank cell it comes across. I cannot get it working right, can anyone help??
Thanks very much
-
Feb 29th, 2012, 04:29 PM
#2
Frenzied Member
Re: Please Help!!.
you need to show some code so that we can help
-
Feb 29th, 2012, 09:11 PM
#3
Thread Starter
New Member
Re: Please Help!!.
Sub ExportAgain()
'
' ExportAgain Macro
' append
ActiveWorkbook.Unprotect "nhp2012"
Sheets("EXPORT").Visible = True
Application.Goto Sheets("Export").Range("ExportRange")
Selection.Copy
Workbooks.Open Filename:="F:\HOME\COMMERCIAL\SMALL GROUP RATE MODELS\ACCT_DATA_STORE_2012.xlsx", _
Password:="nhp2012", WriteResPassword:="nhp2012"
If Range("A2").Value = "" Then
Range("A2").Select
Else
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
End If
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWindow.Close
Sheets("Export").Select
ActiveWindow.SelectedSheets.Visible = False
ActiveWorkbook.Protect "nhp2012"
ActiveWorkbook.Protect Structure:=True, Windows:=False
ActiveWorkbook.Save
End Sub
-
Mar 1st, 2012, 03:19 PM
#4
Re: Please Help!!.
I cannot get it working right, can anyone help??
what happens?
error?
wrong result?
nothing?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 2nd, 2012, 09:02 AM
#5
Thread Starter
New Member
Re: Please Help!!.
I get a Microsoft Visual Basic error that just says '400'?
-
Mar 2nd, 2012, 05:57 PM
#6
Frenzied Member
Re: Please Help!!.
the error appears to be about something that does not exist..
you need to fill your code with stops and identify where the error comes from
here to help
-
Mar 2nd, 2012, 10:07 PM
#7
Thread Starter
New Member
Re: Please Help!!.
I am new to this, please help me with it. How do I put stops into the code?
-
Mar 3rd, 2012, 02:15 AM
#8
Re: Please Help!!.
I get a Microsoft Visual Basic error that just says '400'?
on which line?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 15th, 2012, 01:35 PM
#9
Re: Please Help!!.
Re. "How do I put stops in code?"
You literally just type "stop" in any available line of code. I would suggest right at the start of your sub, like this:
Code:
Sub checkIt()
Stop
Dim myValue As Integer
myValue = Cells(3, 5)
'other code...
End Sub
Then, once it goes into "break" mode, you can hit F8 to advance one line of code at a time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|