Click here to Skip to main content
15,921,941 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questiontextbox Pin
kewyn24-Oct-08 5:58
kewyn24-Oct-08 5:58 
AnswerRe: textbox Pin
Jon_Boy24-Oct-08 6:05
Jon_Boy24-Oct-08 6:05 
AnswerRe: textbox Pin
Dave Kreskowiak24-Oct-08 7:19
mveDave Kreskowiak24-Oct-08 7:19 
QuestionVB auto updater for application Pin
Member 404257024-Oct-08 4:30
Member 404257024-Oct-08 4:30 
AnswerRe: VB auto updater for application Pin
Dave Kreskowiak24-Oct-08 4:38
mveDave Kreskowiak24-Oct-08 4:38 
AnswerRe: VB auto updater for application Pin
Paul Conrad24-Oct-08 4:57
professionalPaul Conrad24-Oct-08 4:57 
GeneralRe: VB auto updater for application Pin
Member 404257024-Oct-08 5:08
Member 404257024-Oct-08 5:08 
Questionselecting cells to save in another excel sheet using vba Pin
weelilin24-Oct-08 1:57
weelilin24-Oct-08 1:57 
Hi i am new here and also new to vba(just started to learn a few days ago).
i have and excel spreadsheet name generating new exchnage rate.xls.
I am trying to figure out how to extra certain cells ( example : b4 to b50 and e4 to e50) and also adding in the title into each respective cells ( example : under b4 to b50 the title will be currency )and save it into a new excel sheet.
I already got the new excel sheet up.The thing i am stuck with is the cells and title part.Any help would be greatly appreciate.My codes are as below.Thanks =D.


my codes

Option Explicit

Public Sub Revaluation()
Dim NewName As String
Dim nm As Name
Dim ws As Worksheet
Dim fname As Variant

If MsgBox("Copy specific sheets to a new workbook" & vbCr & _
"New sheets will be pasted as values, named ranges removed" _
, vbYesNo, "NewCopy") = vbNo Then Exit Sub

With Application
.ScreenUpdating = False

' Copy specific sheets
' *SET THE SHEET NAMES TO COPY BELOW*
' Array("Sheet Name", "Another sheet name", "And Another"))
' Sheet names go inside quotes, seperated by commas
On Error GoTo ErrCatcher
Sheets(Array("Exchange rate")).Copy
On Error GoTo 0

' Paste sheets as values
' Remove External Links, Hperlinks and hard-code formulas
' Make sure A1 is selected on all sheets
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Copy
ws.[A1].PasteSpecial Paste:=xlValues
ws.Cells.Hyperlinks.Delete
Application.CutCopyMode = False
Cells(1, 1).Select
ws.Activate
Next ws
Cells(1, 1).Select

' Remove named ranges
For Each nm In ActiveWorkbook.Names
nm.Delete
Next nm


' Input box to name new file
'NewName = InputBox("Please Specify the name of your new workbook", "New Copy")

' Save it with the NewName and in the same directory as original
ActiveWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & NewName & "Revaluation.xls"
'ThisWorkbook.Path & "\" & NewName & ".xls"
ActiveWorkbook.Close SaveChanges:=False

.ScreenUpdating = True
End With
Exit Sub

ErrCatcher:
MsgBox "Specified sheets do not exist within this workbook"
End Sub
QuestionFormating of String Pin
pdnet24-Oct-08 1:50
pdnet24-Oct-08 1:50 
AnswerRe: Formating of String Pin
Dave Kreskowiak24-Oct-08 2:09
mveDave Kreskowiak24-Oct-08 2:09 
GeneralRe: Formating of String Pin
pdnet24-Oct-08 2:39
pdnet24-Oct-08 2:39 
GeneralRe: Formating of String Pin
Dave Kreskowiak24-Oct-08 4:15
mveDave Kreskowiak24-Oct-08 4:15 
AnswerRe: Formating of String Pin
Jon_Boy24-Oct-08 2:22
Jon_Boy24-Oct-08 2:22 
GeneralRe: Formating of String Pin
pdnet24-Oct-08 2:37
pdnet24-Oct-08 2:37 
AnswerRe: Formating of String Pin
Ashfield24-Oct-08 2:57
Ashfield24-Oct-08 2:57 
GeneralRe: Formating of String Pin
pdnet24-Oct-08 3:02
pdnet24-Oct-08 3:02 
GeneralRe: Formating of String [modified] Pin
Jon_Boy24-Oct-08 3:17
Jon_Boy24-Oct-08 3:17 
GeneralRe: Formating of String Pin
Dave Kreskowiak24-Oct-08 4:18
mveDave Kreskowiak24-Oct-08 4:18 
GeneralRe: Formating of String Pin
Ashfield24-Oct-08 5:14
Ashfield24-Oct-08 5:14 
GeneralRe: Formating of String Pin
Jon_Boy24-Oct-08 5:59
Jon_Boy24-Oct-08 5:59 
GeneralRe: Formating of String Pin
pdnet24-Oct-08 21:18
pdnet24-Oct-08 21:18 
GeneralRe: Formating of String Pin
Dave Kreskowiak25-Oct-08 3:01
mveDave Kreskowiak25-Oct-08 3:01 
GeneralRe: Formating of String Pin
Jon_Boy27-Oct-08 1:51
Jon_Boy27-Oct-08 1:51 
GeneralRe: Formating of String Pin
pdnet24-Oct-08 21:17
pdnet24-Oct-08 21:17 
GeneralRe: Formating of String Pin
Ashfield25-Oct-08 4:55
Ashfield25-Oct-08 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.