Creating template in VBA

RobbertH

Active Member
Joined
Apr 29, 2008
Messages
310
Hi Guys,

Probably an easy one but I cant get the following to work...

I have a download from a system which gives my a bunch of data. Out of this data I'd like to create a template. The template is a copy of the data when the cell value in column B is a number.

The following code will copy everything, also when B.. has text in it. Where do I go wrong?
Code:
Sub Create_Template()
On Error Resume Next
r = 5
For Each Cell In Range("B1:B1000")
    If 1 / Cell.Value > 0 Then
        Worksheets("Template").Cells(r, 2).Value = Cell.Value
        Worksheets("Template").Cells(r, 3).Value = Cell.Offset(0, 1).Value
        Worksheets("Template").Cells(r, 4).Value = Cell.Offset(0, 4).Value
    End If
    r = r + 1
Next Cell
End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top