Importing CSVs into Pre-Formatted Data Sheet - Start and Stop Macro

cappiccolo

New Member
Joined
May 11, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a .csv where (once text to columns and bold for emphasis, to try to make it easier to see) it's formatted like this. I need to be able to import this into a template so that I can work with it - new files come through every day.

I found a super useful thread with a response from Trevor_S about this kind of problem with a macro, and I think this could work for me. My query is kind of a next step, I guess. I'm wondering how to tell a macro when to stop, because it needs to stop before the last row in this instance. For example if I want to take the data from rows 4 - 12, rather than from 4 to the end, how would I do that? Particularly as there are three instances of RECORD_TYPE.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi *cappiccolo - Welcome to the forum. The code below starts at Row 4 and selects Row 4, then 5 through 12 sequentially. You may be able to modify this for your needs. Hope this helps get you started.

VBA Code:
Sub Rows4to12()
Dim i As Integer
i = 4

    While i < 13
     Cells(i, 1).EntireRow.Select
     i = i + 1
    Wend

End Sub
 
Upvote 0
Solution
Hi *cappiccolo - Welcome to the forum. The code below starts at Row 4 and selects Row 4, then 5 through 12 sequentially. You may be able to modify this for your needs. Hope this helps get you started.

VBA Code:
Sub Rows4to12()
Dim i As Integer
i = 4

    While i < 13
     Cells(i, 1).EntireRow.Select
     i = i + 1
    Wend

End Sub
Thanks, goesr! That does indeed get me closer. Much appreciated.
 
Upvote 0

Forum statistics

Threads
1,215,003
Messages
6,122,655
Members
449,091
Latest member
peppernaut

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